home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / SML⁄NJ 93+ / Documentation / bugs / masterbugs < prev    next >
Encoding:
Text File  |  1995-12-30  |  1.0 MB  |  33,705 lines  |  [TEXT/R*ch]

Text Truncated. Only the first 1MB is shown below. Download the file for the complete contents.
  1. Master Bug List, Standard ML of New Jersey as of June 26, 1991.
  2. Most of these bugs have been fixed; these are all bugs ever reported.
  3.  
  4. -------------------------------------------------------------------------------
  5. 1. Identifier as functor body (dbm)
  6. Problem: 
  7.   Using a parameter structure variable as the body of a functor yields an
  8.   error message.
  9. Code:
  10.    functor F(structure A: sig end) = A
  11. Messages:
  12.    Error: unbound structure id: A
  13. Comment:
  14. Status: fixed in 0.20, along with some related bugs involving lack of
  15.   visibility of parameters on the rhs of functor declarations.
  16. -------------------------------------------------------------------------------
  17. 2. Mispelled nonnullary constructors in patterns
  18. Problem: 
  19.   Mispelling a constructor with arguments in a pattern leads to misleading
  20.   error messages.
  21. Version: 0.18
  22. Code:  (in typing/typecheck.sml)
  23.       ...
  24.            app genType rvbs
  25.        end
  26.        | EXCEPTIONdec(ebs) =>
  27.        let fun checkWeak(VARty(ref(UNBOUND id))) = 
  28.              if tyvarWeakness id > abs
  29.              then condemn "type variable in exception type too strong"
  30.       ...
  31. Status: Fixed in 0.50
  32. -------------------------------------------------------------------------------
  33. 3. Redefining an open structure at top level
  34. Problem:
  35.   It appears that redeclaration of an opened structure S releases the
  36.   runtime binding of S, even though we can still refer to its component
  37.   x.  We get the effect of a kind of dangling reference.  Need to avoid
  38.   reclaiming S if S is open at the point where it is redeclared.
  39. Version: 0.18
  40. Code:
  41.     - structure S = struct datatype t = A val x = A end;
  42.     structure S : <sig>
  43.     - S.x;
  44.     val it = A : S.t
  45.     - open S;
  46.     open S
  47.     - x;
  48.     val it = A : t
  49.     - type t = bool;
  50.     type t = bool
  51.     - x;
  52.     val it = A : S.t
  53.     - structure S = struct end;
  54.     structure S : <sig>
  55.     - x;
  56.     uncaught exception Intmap
  57.     - 
  58. Comment:
  59.   Need to detect the fact that a structure has been opened at the top level
  60.   and if so it's lvar binding should not be deleted from the top-level environment.
  61. Status: fixed in 0.20.  top level opens copy bindings into top level environment.
  62. --------------------------------------------------------------------------------
  63. 4. duplicate specifications not checked
  64. Problem:
  65.   No checking for duplicated specifications in signatures.
  66. Version: 0.18
  67. Comment:
  68.   This should be done when building the signature symbol table.
  69.   See bug 81.  (elg)
  70. Status: fixed in 0.73
  71. --------------------------------------------------------------------------------
  72. 5. exportML environment
  73. Problem:
  74.   Subtle bug in exportML: it exports the environment of the person who
  75.   originally booted the system, and this environment is restored when
  76.   the image is started up.  This effects system, execute, and
  77.   subsequent exportML's.  On startup, exportFN destroys the environment
  78.   and command-line args, and this too could have adverse effects on
  79.   those functions.
  80. Version: 0.18
  81. Status: fixed in version 0.31
  82. --------------------------------------------------------------------------------
  83. 6. open file descriptors
  84. Problem:
  85.   File descriptors open in the ML system remain open on a call of system.
  86. Version: 0.18
  87. Comment:
  88.   I haven't decided what I want to do about this yet.  We
  89.   might like only stdin, stdout, and stderr to remain open.
  90.   Note that if the parent closes one of them, it will be closed in the
  91.   child as well (it inherits them rather than getting new ones).
  92.   Note that
  93.       ioctl(fd,FIOCLEX,(void *)0)
  94.   will cause a file descriptor to be closed on an exec.  This could be
  95.   called after each open (but shouldn't be called on pipes).
  96.   Another possibility is just to leave them all open.
  97. Status: not a bug, reflects Unix semantics
  98. --------------------------------------------------------------------------------
  99. 7. constructor representation
  100. Problem:
  101.   There is a bug involving constructor representation.  The compiler
  102.   examines the structure of a datatype and tries to determine an efficient
  103.   runtime representation for it.  For example, for the list datatype, nil
  104.   can be represented as an integer, and :: can just be a pointer to its
  105.   tuple argument (integers and tuples are distinct).  This fails in our system
  106.   at the structure level.  For example:
  107. Version: 0.18
  108. Code:
  109.     signature S = sig
  110.     type 'a t
  111.     datatype 'a list = nil | :: of 'a t
  112.     end
  113.     structure A : S = struct
  114.     datatype 'a list = nil | :: of 'a * 'a list
  115.     withtype 'a t = 'a * 'a list
  116.     end
  117. Comment:
  118.   Here the compiler can deduce the efficient representation for the
  119.   (local) list datatype in structure A; but this cannot be deduced in
  120.   the signature S (an object of type 'a t might not be a pointer).
  121. Status: An error message is now generated (0.54) when this occurs.
  122. --------------------------------------------------------------------------------
  123. 8. interactive error recovery
  124. Problem:
  125.   In the interactive mode, parser error recovery should be suppressed
  126.   (but isn't); the parser may continue to look for input after an error,
  127.   when the user would expect to be back at top level.
  128. Version: 0.18
  129. Status: Fixed in 0.52
  130. --------------------------------------------------------------------------------
  131. 9. behavior at limits (e.g. stack overflow)
  132. Problem:
  133.   The behavior of the system when it reaches limits is sometimes bizarre.
  134.   For instance, on a Sun, if the system runs out of stack space it
  135.   will die with "Illegal instruction".  This is because the signal can't
  136.   be handled since the stack is full.  A possible fix would be to use a
  137.   separate stack to handle signals, but the handler would have to be
  138.   smart, since SIGSEGV would be raised.  Note that the stack limit can
  139.   be changed with the limit command; and hopefully this particular bug will
  140.   disappear with the next version of the code generator.
  141. Version: 0.18
  142. Status: fixed in version 0.31
  143. --------------------------------------------------------------------------------
  144. 10. exhaustiveness messages at top-level
  145. Problem: Top level bindings should not report on exhaustiveness, but they do.
  146. Version: 0.18
  147. Status: Not important.
  148. --------------------------------------------------------------------------------
  149. 11. poor error messages [parser]
  150. Problem: Poor error message (parens are needed around the hd::tl pattern):
  151. Version: 0.18
  152. Code:
  153.    -  fun f hd::tl = 4;
  154. Messages:
  155.     Error: expected EQUAL, found ID (::)
  156.     Error: expected nonfix-identifier, found ID ::
  157.     Error: unbound variable bogus
  158.     Error: type error: operator and operand don't agree
  159.     operator : ((wrong*wrong list) -> wrong list)
  160.     operand : (wrong*('aA list -> 'aA list))
  161.     expression:
  162.       bogus :: tl
  163.     - 
  164. Comment:
  165.   The "unbound variable bogus" in particular is confusing.
  166. Status: Fixed in 0.52.
  167. -----------------------------------------------------------------------------
  168. 12. loss of information in value printing
  169. Problem:
  170.   When printing values formed using constructors created by functor application,
  171.   the argument type of the constructor can sometimes be lost, resulting in
  172.   inability to print the value accurately.
  173. Version: 0.18
  174. Code:
  175.     - functor F(type t) =
  176.     = struct
  177.     =   datatype r = C of t
  178.     = end;
  179.  
  180.     - structure S = F(type t = int);
  181.  
  182.     - S.C 3;
  183.   [1]   val it = C - : S.r
  184.  
  185.   But
  186.       - signature SS = sig type t datatype r = C of t end;
  187.  
  188.         - structure S = struct type t = int  datatype r = C of t end;
  189.  
  190.     - S.C;
  191.     val it = fn : ?.t -> S.r
  192.  
  193.     - S.C 3;
  194.     val it = C 3 : S.r
  195.  
  196.   and
  197.     - structure S': SS = struct type t = int  datatype r = C of t end;
  198.     - S'.C;
  199.     val it = fn : ?.t -> S'.r
  200.     - S'.C 3;
  201.     val it = C 3 : S'.r
  202.  
  203. Comments:
  204.   Printing the argument type of C at [1] yields "IND/1/", indicating that
  205.   the type of C contains an indirection that is not interpreted in context.
  206.   It does not seem possible to recover the context from the structure S, because
  207.   there is no simple way to get back from the type S.r or the DATACON C to the 
  208.   structure environment.  This may be a reason for having type constructors
  209.   contain a pointer to their home structure rather than just the symbolic
  210.   path.  Another alternative would be to follow the path in S.r to find the
  211.   structure S so that we can use it as context for the type of C.
  212. Status: fixed in 0.58
  213. -----------------------------------------------------------------------------
  214. 13. printing of types from abstraction structure
  215. Problem:
  216.   Printing of types from an abstraction is not quite right.
  217. Code: (test/sigs/test7)
  218.     signature FOO = 
  219.     sig
  220.        type T1 and T2
  221.        val x1: T1 and x2: T2
  222.        sharing type T1 = T2
  223.     end
  224.  
  225.     abstraction Foo: FOO =
  226.     struct
  227.        datatype T1 = CON
  228.        type T2 = T1
  229.        val x1 = CON and x2 = CON
  230.     end
  231.  
  232.     [Foo.x1,Foo.x2];
  233. Messages:
  234.     [-,-] : ?.T1   (* should be Foo.T1 *)
  235. Status: Fixed in 0.56
  236. --------------------------------------------------------------------------------
  237. 14. Bad printing of list values
  238. Problem: list values printed with :: instead of [...]
  239. Version:
  240. Code:
  241.     datatype Foo = FOO of int list
  242.     val it = FOO [1, 2, 3]
  243. Messages:
  244.     FOO (1 :: 2 :: 3 :: nil): Foo
  245. Comments:
  246. Status: Fixed in version 0.25.
  247. --------------------------------------------------------------------------------
  248. 15. Error message
  249. Problem: Unfortunate error message (I left out `type'):
  250. Version: ?
  251. Code: 
  252.     - signature STWO = sig structure X:SIG and Y:SIG sharing X.t=Y.t end;
  253. Messages:
  254.     Error: bad path is sharing specification
  255. Comments:
  256.    (It's also misspelled.)
  257. Status: fixed in 0.56
  258. --------------------------------------------------------------------------------
  259. 16. "use" errors
  260. Problem:
  261.   Untidy interface to "use". "use" on a nonexistent file still prints the
  262.   "[opening ...]" message and then raises Io_failure - shouldn't it just
  263.   say "[cannot open ...]" or something?
  264. Status: fixed
  265. --------------------------------------------------------------------------------
  266. 17. Inaccurate line numbers
  267. Problem:
  268.     Misleading line numbers for some things (eg. type errors in multi-line
  269.     datatype declarations). Could the system print something like
  270.     "Line 33ff", or a line range a la LaTeX, for these?
  271. Status: fixed in 0.53
  272. --------------------------------------------------------------------------------
  273. 18. Bad error messages for illegal record expression
  274. Version: [< 0.16]
  275. Problem:
  276.     interesting diagnostic in the (meaningless) expression
  277. Code:
  278.     - {3};
  279. Messages:
  280.     Error: expected RBRACE, found INT
  281.     Error: type error: operator and operand don't agree
  282.     operator : unit
  283.     operand : int
  284.     expression:
  285.       () 3
  286.  
  287.     Error: declaration or expression expected, found RBRACE
  288. Comment:
  289.     What's the "() 3"?
  290. Status: fixed in 0.53
  291. --------------------------------------------------------------------------------
  292. 19. Exception declaration with ":"
  293. Problem: This gives a type error rather than a syntax error: odd:
  294. Version: ?
  295. Code:
  296.         - signature FOO = sig exception Foo of string end;
  297.  
  298.         - structure Foo: FOO = struct exception Foo: string end;
  299.                                                =-> ^ <-=
  300. Messages:
  301.         Error: Type in structure doesn't match signature
  302.         name = Foo
  303.         spec = (string -> exn)
  304.         actual = exn
  305. Comments:
  306.   Without signature constraint ":FOO" in declaration of Foo you get a syntax
  307.   error: "expected END, found COLON".  With the signature, you get the above
  308.   type error but no complaint about the ":".
  309. Status: fixed in 0.53
  310. --------------------------------------------------------------------------------
  311. 20. "print" seems overloaded rather than polymorphic:
  312. Problem: print is overloaded rather than being polymorphic
  313. Version: -
  314. Code:
  315.     - datatype Foo = FOO1 | FOO2;
  316.     - print FOO1;
  317. Messages:
  318.     Error: type error: no match for overloaded variable:
  319.     print
  320. Comments:
  321.     according to the original SML report, both "print" and "makestring"
  322.     should be polymorphic identity functions. In our compiler, "print"
  323.     is correctly polymorphic. "makestring" is (incorrectly) overloaded,
  324.     disallowing "makestring FOO1". Needless to say, I want to be able
  325.     to do "makestring" on datatypes.
  326. Status: not a bug
  327. --------------------------------------------------------------------------------
  328. 21. Bad error recovery in the typechecker:
  329. Problem:
  330. Version: 0.15a
  331. Code:
  332.     - signature SIG = sig
  333.          exception Foo of int
  334.          val A: int
  335.          val B: int
  336.          val C: int
  337.       end;
  338.  
  339.     - structure S: SIG =
  340.          struct
  341.         exception Foo: int
  342.                  ^
  343.         val A = 1
  344.         val B = 2
  345.         val C = 3
  346.          end
  347. Messages:
  348.     Error: Type in structure doesn't match signature
  349.     name = Foo
  350.     spec = (int -> exn)
  351.     actual = exn
  352.     Error: unmatched val spec: A
  353.     Error: unmatched val spec: B
  354.     Error: unmatched val spec: C
  355.     ^ there can be a lot of these!
  356. Comments:
  357.     Sometimes the exception error doesn't appear, just giving the unmatched
  358.     spec errors, rather misleadingly.
  359. Status: fixed in 0.53
  360. --------------------------------------------------------------------------------
  361. 22. inherited environment of subprocesses
  362. Problem:
  363.   (one you know about) - subprocesses created via "execute" inherit
  364.   the environment present when the ML system was built! Also: broken
  365.   pipe errors should be caught and raise Io_failure?
  366. Status: fixed in 0.31
  367. --------------------------------------------------------------------------------
  368. 23. circularity in substructure relationship
  369. Problem:
  370.   No checking for circular sharing constraints.  Circular constraints cause
  371.   unhandled Notfound_Table exception.
  372. Code:
  373.     - signature Sig =
  374.         sig
  375.         structure D: sig
  376.                 structure E: sig end
  377.                  end
  378.  
  379.         sharing D = D.E
  380.          end;
  381. Messages:
  382.     uncaught exception Notfound_Table
  383. Comments:
  384.   By the way - why is "sharing structure D = D.E" illegal above? (it
  385.   dislikes the word "structure".)
  386.   See bug 33. (elg)
  387. Status:
  388.   Not considered a bug (signature can't be matched, -- this property could
  389.   be statically detected in the compiler, but isn't).
  390. --------------------------------------------------------------------------------
  391. 24. incomplete write
  392. Submitter: Nick
  393. Comments:
  394.     I'm trying to put in some bullet-proof error recovery into my
  395.     subprocess software, so that "^C" at ML top-level doesn't
  396.     confuse the daemon. What happens if an "output" operation is
  397.     active when ^C is hit - does it do a partial write? I seem to be
  398.     getting some buffer corruption somewhere, as a partial write is
  399.     immediately followed by another complete write. It might make
  400.     my life easier if "output" could be guaranteed atomic under "^C"
  401.     (i.e. any single output operation will complete before Interrupt
  402.     gets raised).
  403.        Just a thought. I'll perhaps put timers into the daemon and ML code
  404.     so that they flush and restart properly - this may solve the problem.
  405. Status: New signal-handling stuff in 0.56 makes this less important.
  406. --------------------------------------------------------------------------------
  407. 25. parser vs grammar (?)
  408. Problem: Parser doesn't accept "vb ::= rec rec vb".
  409. Status: language problem
  410. --------------------------------------------------------------------------------
  411. 26. export ML within a use
  412. Problem:
  413.     Awkward behaviour when exportML is called while a file is being
  414.     "use"'d - the saved state falls over with Io_failure. Shouldn't
  415.     restarting clear the use stack?Version:
  416. Status:
  417.   Modified in version 18 so the image doesn't die.  It still raises
  418.   Io_failure, though. (tyj)
  419.   Fixed in 0.56
  420. --------------------------------------------------------------------------------
  421. 27. different numbers of arguments in curried clauses cause bogus type error
  422. Version: 0.15
  423. Code:
  424.     fun compose [] = (fn x => x) |
  425.     compose (f::fl) x = compose fl (f x);
  426. Messages:
  427.     Error: type error: rules don't agree
  428.      expected: ('a list -> ('b -> 'b))
  429.      found:
  430.       (f :: fl,x) => compose fl (f x)
  431.       : ((('c -> 'd) list*'c) -> 'e)
  432. Status: fixed in 0.19.
  433. --------------------------------------------------------------------------------
  434. 28. tyvars in top-level type constraint
  435. Submitter: Carl Gunter, gunter@linc.cis.upenn.edu (also Reppy, 4/20/88)
  436. Date: 3/27/88
  437. Version: 0.18
  438. Problem: tyvars not accepted in top-level type constraint
  439. Code:
  440.     - length : 'a list -> int;
  441. Messages: (compiler messages associated with bug)
  442.     Error: lookTyvar -- unbound tyvar in closed scope
  443.     Error: Impossible error: generalizeTy -- bad arg
  444.     undef list -> int
  445. Status: fixed in 0.20  (put protectTyvars around top level expression parse).
  446. --------------------------------------------------------------------------------
  447. 29. use_string in structure definition
  448. Submitter: Nick
  449. Date: 3/24/88
  450. Version: 0.18
  451. Problem: use_string can cause uncaught Intmap exception
  452. Code:
  453.     - structure Foo =
  454.        struct
  455.       val x = use_stream(open_string "val _ = Foo.x;")
  456.        end;
  457. Messages: 
  458.     [opening <instream>]
  459.     [closing <instream>]
  460.     uncaught exception Intmap
  461. Comments: This code shouldn't work, but the Intmap exception should be caught.
  462. Status: Fixed in 0.54
  463. --------------------------------------------------------------------------------
  464. 30. weakness 0 in constraint
  465. Date: 4/5/88
  466. Version: 0.18
  467. Problem:
  468. Code:
  469.        - fn (x: '0a) => x;
  470. Messages:
  471.        Error: lookTyvar -- inbound tyvar in closed scope
  472.        Error: Impossible error: generalizeTy -- bad arg
  473.        undef -> undef
  474. Comments: 
  475.     Weak-tyvars of level 0 should raise an error when they occur in
  476.     constraints.
  477. Status: 
  478.     fixed (indirectly) in 0.20.  causes error
  479.       Error: can't generalize weak type variable
  480.       '0a -> '0a
  481. --------------------------------------------------------------------------------
  482. 31. redefining an open structure orphans r/t bindings
  483. Submitter: John Reppy, jhr@svax.cs.cornell.edu
  484. Date: 4/4/88
  485. Version: 0.18
  486. Problem:
  487.     Redefining a structure after opening it makes its components inaccessible
  488.     at runtime even though they are still visible, because the structure
  489.     binding is removed from the r/t intmap environment.
  490. Code:
  491.     val it = () : unit
  492.     - structure S = struct type t = int; val x = 1 end;
  493.     structure S : <sig>
  494.     - open S;
  495.     open S
  496.     - structure S = struct type t = bool; val x = true end;
  497.     structure S : <sig>
  498.     - x;
  499. Messages:
  500.     uncaught exception Intmap
  501. Comments: can't eliminate a structure from r/t env if it has been opened
  502.       See bug 1. (elg)
  503. Status: fixed
  504. --------------------------------------------------------------------------------
  505. 32. printing loops
  506. Submitter: Andrew
  507. Date: 4/6/88
  508. Version: 0.18
  509. Problem: printing a cyclic data structure involving a ref loops
  510. Code:
  511.     datatype A = B | C of A ref
  512.     val x = C(ref B);
  513.     val C y = x;
  514.     y := x;
  515.     x;
  516. Messages:
  517.     prints endlessly
  518. Comments: 
  519.     probably not handling ref constructors properly in tracking depth
  520. Status: fixed in 0.20.  missing base (depth = 0) in printDcon in printval.sml.
  521. --------------------------------------------------------------------------------
  522. 33. cyclical sharing not checked, parsing problem
  523. Submitter: Mads
  524. Date: 4/12/88
  525. Version: 0.18
  526. Problem: cyclical sharing not detected, but leads to parsing bug
  527. Code:
  528.     (1)
  529.  
  530.     signature Sig =
  531.       sig structure a:
  532.         sig structure b: sig end
  533.         end
  534.       structure a': sig end sharing a = a'
  535.       structure b': sig end sharing b' = a.b
  536.       sharing a' = b'
  537.       end
  538.  
  539.     This example should be rejected because it would lead to a cycle in 
  540.     the signature for 'a' (the semantics Section 5.4). If one deletes the
  541.     last sharing obtaining
  542.  
  543.     (2)
  544.  
  545.     signature Sig =
  546.       sig structure a:
  547.         sig structure b: sig end
  548.         end
  549.       structure a': sig end sharing a = a'
  550.       structure b': sig end sharing b' = a.b
  551.       end
  552.  
  553.     one get a legal program. However these examples do not survive
  554.     parsing. (I get an "uncaught exception Notfound_Table"). Ignoring
  555.     this, will your sharing algorithm cope with this subtlety?
  556. Messages:
  557.     uncaught exception Notfound_Table  (now fixed)
  558. Comments:
  559.     We may not try to find cycles, since they would in any case prevent
  560.     the signature from matching any structure.  [dbm]
  561. Status: partially fixed in 0.20.  cycle not detected, but exception is handled.
  562. --------------------------------------------------------------------------------
  563. 34. uncaught Instantiate in type checking
  564. Submitter: Trevor
  565. Date: 4/14/88
  566. Version: 0.18
  567. Problem: uncaught Instantiate exception during type checking
  568. Code:
  569.     structure foo =
  570.     struct
  571.  
  572.     local
  573.       exception Sort
  574.     in
  575.     fun sort (op > : ('x * 'x -> bool))
  576.        = let fun select(min, best, hd::tl) = select(min,
  577.                           if best > min
  578.                            then if best > hd andalso hd > min
  579.                              then hd else best
  580.                            else hd,
  581.                           tl)
  582.            | select(min, best, nil) = best;
  583.          fun lowest(best, hd::tl) = lowest( (if hd>best then best else hd), tl)
  584.            | lowest(best, nil) = best;
  585.          fun s (l as (hd::tl), min) = min
  586.            | s _ = raise Sort
  587.       in fn (l as (hd::tl)) => let val v = lowest(hd,tl) in v :: s(l, v) end
  588.           | nil => nil
  589.      end
  590.     end (* local *)
  591.  
  592.     end
  593. Messages:
  594.     uncaught exception Instantiate
  595. Comments:
  596. Status: fixed in 0.20.
  597. --------------------------------------------------------------------------------
  598. 35. Compiler bug: abstractType
  599. Submitter: Andrew
  600. Date: 4/6/88
  601. Version: 0.18
  602. Problem: type error in functor definition causes Compiler bug error
  603. Code:
  604.     signature FORMULA =
  605.      sig
  606.      type formula
  607.      val NUM : formula
  608.      end
  609.  
  610.     functor Parse(F : FORMULA) = 
  611.     struct
  612.  
  613.        fun parse() : F.formula = (0, F.NUM)
  614.     (*  val parse : unit -> F.formula = (fn () => (0, F.NUM))  -or-
  615.     (*  val parse : F.formula = (0, F.NUM) -- don't cause abstractType error *)
  616.  
  617.     end
  618. Messages:
  619. Error: expression and constraint don't agree (tycon mismatch)
  620.   expression: int * ?.formula
  621.   constraint: ?.formula
  622.   in expression:
  623.     (0,NUM)
  624. Error: Compiler bug: abstractType
  625. Status: fixed
  626. --------------------------------------------------------------------------------
  627. 36. overloading resolution and order of recursive definitions
  628. Submitter: Dave
  629. Date: 5/2/88
  630. Version: 0.18
  631. Problem: 
  632.     overloading resolution can depend on the order in which mutually
  633.     recursive definitions occur
  634. Code:
  635.     fun f x = x + x
  636.     and g() = f 1
  637.       (* + is not resolved *)
  638.     fun g() = f 1
  639.     and f x = x + x
  640.       (* + is resolved *)    
  641. Status: fixed in 0.52, approximately.
  642. --------------------------------------------------------------------------------
  643. 37. type printing
  644. Submitter: Nick
  645. Date: 5/3/88
  646. Version: 0.18
  647. Problem: valid path is not printed for a type
  648. Code:
  649.     - signature SIG = sig type t val x: t end
  650.       structure S: SIG = struct type t = int val x = 3 end;
  651. Messages:
  652.     signature SIG
  653.     structure S : <sig>
  654.     - S.x;
  655.     val it = 3 : ?.t
  656.              ^ ???
  657. Comments:
  658. Status: fixed in 0.20. (not sure how! as side-effect of another fix?)
  659. --------------------------------------------------------------------------------
  660. 38. incompatible sharing raises Notfound_Table
  661. Submitter: Nick
  662. Date: 5/3/88
  663. Version: 0.18
  664. Problem:
  665.     sharing specification between two incompatible structures causes an
  666.     uncaught Notfound_Table exception.
  667. Code:
  668.     - signature FOO1 =
  669.          sig
  670.             structure S: sig type S end
  671.             structure T: sig type T end
  672.             sharing S = T
  673.          end;
  674. Messages:
  675.     uncaught exception Notfound_Table
  676. Status: fixed in 0.20.  Added handlers for Notfound_Table in function
  677.     sMerge in typing/sharing.sml.
  678. --------------------------------------------------------------------------------
  679. 39. type abbrev not recognized as function type
  680. Submitter: dbm
  681. Date: 5/12/88
  682. Version: 0.19
  683. Problem:
  684.     type abbreviation expands to function type, but not recognized as 
  685.     a functional type by the type checker
  686. Code:
  687.     type 'a church = ('a -> 'a) -> ('a -> 'a);
  688.     val zero = fn f => fn x => x
  689.     val succ = fn n => fn f => fn x => f (n f x)
  690.     val pred = fn n : 'a church =>
  691.          ((fn (_,b)=>b) (n (fn (a,b) => (succ a, a)) (zero,zero)))
  692. Messages:
  693.     Error: operator is not a function
  694.     operator: 'a church
  695.     in expression:
  696.       n (fn (a,b) => (succ <exp>,a))
  697. Comments:
  698. Status: fixed in 0.20.  reduced the ratorTy in APPexp case of expType in
  699.     typecheck.sml.
  700. --------------------------------------------------------------------------------
  701. 40. Exception aliasing (match compiler)
  702. Submitter: Dave
  703. Date: 5/12/88
  704. Version: 0.19
  705. Problem:
  706.    Match compiler doesn't cope with exception aliasing (through functor
  707.    parameters, for instance).
  708. Status: fixed in 0.54
  709. --------------------------------------------------------------------------------
  710. 41. missing substructure
  711. Submitter: Dave
  712. Date: 5/18/88
  713. Version: 0.19
  714. Problem:
  715.     substructure required by signature is not declared but appears anyway.
  716. Code:
  717.     signature AS = sig val x: int end
  718.  
  719.     structure A : AS = struct val x = 3 end
  720.  
  721.     signature BS =
  722.     sig
  723.       structure A : AS
  724.     end
  725.  
  726.     structure B : BS =
  727.     struct
  728.       open A
  729.     end
  730. Messages:
  731.    should complain, but doesn't
  732. Comments:
  733. Status: fixed in 0.20.
  734. --------------------------------------------------------------------------------
  735. 42. Two signature matching problems.
  736. Submitter: Bob Harper
  737. Date: 5/20/88
  738. Version: 0.18
  739. Problem:
  740.    (1) missing substructures found in environment,
  741.    (2) bind exception processing sig specs after missing substructure
  742. Code:
  743.     signature SIG = sig type t val x:t end;
  744.  
  745.     signature SIG' = sig structure S:SIG val y:S.t end;
  746.  
  747.     structure T : SIG = struct type t=int val x = 3 end;
  748.  
  749.     structure T' : SIG' = struct structure S=T val y=S.x end;
  750.  
  751.     (* This yields a sensible error message, then an uncaught exception Bind. *)
  752.     structure T'' : SIG' = struct val y=T.x end;
  753.  
  754.     signature SIG'' = sig structure T:SIG val y:T.t end;
  755.  
  756.     (* This should not succeed, but it does!  The unbound structure appears
  757.        in the global environment, so it doesn't notice that the substructure T
  758.        is missing.
  759.     *)
  760.     structure U : SIG'' = struct val y = T.x end;
  761. Messages:
  762. Comments:
  763.     (1) missing substructure was found because lookSTR was being used to
  764.         look for structure components in SigMatch.realize.  Fixed by introducing
  765.     lookSTRlocal that does not search through STRlayer.
  766.     (2) TypesUtil.lookTycPath was causing bind exception because the missing
  767.     substructure defaulted to the unexpected form INDstr(~1).  Caused
  768.     lookTycPath to raise an exception that was caught by typeInContext,
  769.     which then returns ERRORty.  SigMatch.compareTypes ignores the ERRORty.
  770. Status: fixed in 0.20
  771. --------------------------------------------------------------------------------
  772. 43. incorrect error message for sharing constraints
  773. Submitter: Bob Harper
  774. Date: 5/21/88
  775. Version: 0.18
  776. Problem:
  777.     "unbound structure id in sharing spec" error message was reporting the
  778.     wrong structure id.
  779. Code:
  780.     signature SIG = sig end;
  781.  
  782.     signature SIG' = sig
  783.       structure S:SIG
  784.     end;
  785.  
  786.     (* Here it complains that S' is unbound in the sharing specification, but
  787.     actually it's S'.T that is unbound! *)
  788.  
  789.     signature SIG'' = sig
  790.       structure S':SIG'
  791.       structure T:SIG
  792.       sharing S'.T = T
  793.     end;
  794. Messages:
  795.     Error: unbound structure id in sharing specification: S'
  796. Comments:
  797.     Moved one of the handlers for Notfound_Table from findStr to getStr
  798.     in sharing.sml.
  799.   
  800.     0.65 now gives output
  801.  
  802.      std_in:19.3-21.19 Error: unbound structure id in sharing specification: T
  803.  
  804.     it would be better to say that S'.T is unbound.
  805. Status: fixed in 0.20
  806. --------------------------------------------------------------------------------
  807. 44. subscript exception during parsing
  808. Submitter: Dave, Bob Harper
  809. Date: 3/20/88
  810. Version: 0.18
  811. Problem:
  812.    Subscript exception raised during parsing
  813. Code:
  814.    /usr/nml/bugs/bob.4, /usr/nml/examples/micro-ml/make
  815. Messages:
  816.    uncaught exception Subscript
  817. Comments:
  818.    path created by function search in EnvAccess.iterFct was in reversed order.
  819.    added rev.
  820. Status: fixed in 0.20
  821. --------------------------------------------------------------------------------
  822. 45. equality on simple recursive datatype causes compiler to loop
  823. Submitter: Dave
  824. Date: 5/27/88
  825. Version: 0.19
  826. Problem:
  827.   Compiling equality for a trivial recursive datatype causes the compiler
  828.   to loop in Equal.equal.(test).
  829. Code:
  830.   datatype t = A of t
  831.   fun f(x:t) = (x=x)
  832. Comments:
  833.   Of course this is a useless datatype, but someone could define it by mistake
  834.   and cause the compiler to loop.  The problem is the treatment of datatypes
  835.   with a single transparent constructor in the function test in equal.  It
  836.   recursively calls test on the argument type of the constructor, which in this
  837.   case is justs t again.  A datatype like
  838.  
  839.      datatype t = A of t * int
  840.  
  841.   does not cause the loop.
  842. Status: fixed in 0.20
  843. --------------------------------------------------------------------------------
  844. 46. equality type checking and flexrecords
  845. Submitter: Dave
  846. Date: 6/3/88
  847. Version: 0.20
  848. Problem:
  849.     when flexrecords are used a nonequality type may be accepted in a context
  850.     where an equality record type is required
  851. Code:
  852.     fun f(r as {a,...},true) = (r = r)  (* checks only that a admits equality *)
  853.       | f({b,...},false) = b 3 (* oops, the b field is a function! *)
  854. Messages:
  855.     val f = fn : {a:''a,b:int -> bool} * bool -> bool
  856.     (* argument type is not an equality type *)
  857. Comments:
  858.     A fix probably requires a change in the way flexrecords are represented.
  859. Status: fixed in 0.54.  [actually only correctly fixed in 0.85]
  860. --------------------------------------------------------------------------------
  861. 47. scope of user bound type variable
  862. Submitter: Mads Tofte (Edinburgh)
  863. Date: 3/8/88
  864. Version: 0.18
  865. Problem:
  866.   some uses of user-bound type variables have strange effects
  867. Code:
  868.   fun f(x) = let val y : 'a = x in y y end;
  869.   val f = fn : 'a -> 'a
  870.   - f 3;
  871. Messages:
  872.   Error: operator and operand don't agree (bound type var)
  873.   operator domain: 'a
  874.   operand:         int
  875.   in expression:
  876.     f 3
  877. Comments:
  878.   y gets the type !'a.'a, which allows the expression "y y" to type check
  879.   x gets the user bound type variable 'a as its type and it is not generalized
  880.    either when y's type is generalized or when f's type is generalized
  881.   the result type 'a refers to a generically bound type variable which
  882.    coincidentally is printed as 'a
  883. Status: fixed in 0.20
  884.   generates an error message indicating that the user-bound type variable was
  885.   propagated out of its scope.  This is a rather obscure error message, but it
  886.   is not easy to do better.  This seems much better that allowing the propagation
  887.   of the user bound type variable out of its natural syntactic scope, since it
  888.   would be necessary to do arbitrary amounts of type checking to simply determine
  889.   whether two explicit type variables are the same.
  890. --------------------------------------------------------------------------------
  891. 48. printing of identity withtype declarations
  892. Submitter: Dave
  893. Date: 6/9/88
  894. Version: 0.20
  895. Problem:
  896.   A simple identity declaration in the withtype clause of a datatype declaration
  897.   will not be printed properly.
  898. Code:
  899.   datatype foo = A
  900.   withtype t = int;
  901. Messages:
  902.   datatype  foo
  903.   con A : foo
  904.   type  t = t
  905. Comments:
  906.   This happens because the backpatching of the type constructor puts the new
  907.   name in the defining type as well as in the defined type binding.
  908. Status: fixed by 0.54
  909. --------------------------------------------------------------------------------
  910. 49. equality status of type constructors after functor application
  911. Submitter: Dave
  912. Date: 6/10/88
  913. Version: 0.20
  914. Problem:
  915.   type constructors defined in a functor should sometimes become
  916.   equality type constructors when the functor is applied, but they don't.
  917. Status: fixed in 0.20 (* unfixed in 0.56, refixed in 0.57? *)
  918.         Given up on for the time being (since it's not required by the
  919.     standard). (elg) 
  920. --------------------------------------------------------------------------------
  921. 50. free refs to sibling structures within a signature
  922. Submitter: Dave
  923. Date: 6/13/88
  924. Version: 0.20
  925. Problem:
  926.   Free references to a sibling structure in a signature are not allowed
  927. Code:
  928.   signature SS =
  929.   sig
  930.     structure A : sig type t end
  931.     structure B : sig  val x : A.t end
  932.   end
  933. Messages:
  934.   Error: free ref to sibling struct in sig not implemented
  935. Comments:
  936.   Outer signature env has default info, giving rise to Subscript exception when
  937.   attempting to interpret A.
  938. Status: fixed in 0.31
  939. --------------------------------------------------------------------------------
  940. 51. free refs to param struct in functor result signature
  941. Submitter: Dave
  942. Date: 6/13/88
  943. Version: 0.20
  944. Problem:
  945.   Free references to the functor parameter are not allowed in the result
  946.   signature.
  947. Code:
  948.   functor F(S: sig type t val x: t end) : sig val y : S.t end =
  949.   struct
  950.     val y = S.x
  951.   end
  952. Messages:
  953.   Error: unbound head structure: S
  954.     in path: S.t
  955. Comments:
  956. Status: fixed in 0.39
  957. -------------------------------------------
  958. 52. input of large strings
  959. Submitter: Appel&Duba
  960. Date: 9/9/88
  961. Version: 0.20
  962. System: any
  963. Problem: (input f k) was unreliable for k>1024
  964. Status: fixed in 0.22
  965. -------------------------------------------
  966. 53. exportFn broken
  967. Submitter: Appel&Duba
  968. Date: 9/9/88
  969. Version: 0.20
  970. System: any
  971. Problem: exportFn produced an executable that dumped core
  972. Status: fixed in 0.22
  973. -------------------------------------------
  974. 54. problems in Sun Unix version 4.0
  975. Submitter: Appel&Duba
  976. Date: 9/9/88
  977. Version: 0.20
  978. System: Sun 3/SunOS 4.0
  979. Problem: doesn't work; can't boot sml
  980. Status: fixed in 0.22
  981. ------------------------------------------ 
  982. 55. type constraint on field abbreviation
  983. Submitter: Duba
  984. Date: 11/2/88
  985. Version: 0.22
  986. System: any
  987. Problem: won't except type constraint in abbreviated records
  988. Code: fun f{x : int} = 1;
  989. Message: Error: expected EQUAL after label, found COLON
  990. Status: fixed
  991. ------------------------------------------ 
  992. 56. big integer constants
  993. Submitter: Duba
  994. Date: 11/8/88
  995. Version: 0.22
  996. System: cps
  997. Problem: interger constants must be less than 31 bits
  998. Code: 1000000000
  999. Message: Error: Compiler bug: Overflow in cps/generic.sml
  1000. Status: fixed in 0.24
  1001. ---------------------------------------------------------------------------
  1002. 57. open_out causes SystemCall exception
  1003. Submitter: dbm
  1004. Date: 11/10/88
  1005. Version: 0.23
  1006. System: --
  1007. Problem: opening nonwriteable file causes uncaught exception SystemCall
  1008. Code: 
  1009.     LexGen.lexGen "ml.lex";
  1010.     uncaught exception SystemCall
  1011.     - system "ls -l";
  1012.     total 38
  1013.     -r--r--r--  2 dbm           993 Nov  9 12:03 ascii.sml
  1014.     -r--r--r--  2 dbm          3207 Nov  9 12:03 hookup.sml
  1015.     -r--r--r--  2 dbm          2813 Nov  9 12:03 ml.lex
  1016.     -r--r--r--  2 dbm         23900 Nov  9 12:03 ml.lex.sml
  1017.     -r--r--r--  2 dbm          2698 Nov  9 12:03 symbols.sml
  1018.     -r--r--r--  2 dbm          2599 Nov  9 12:03 timelex.sml
  1019.     val it = () : unit
  1020. Messages:
  1021. Comments:  Attempting to open an unreadable file for input raises Io_failure,
  1022.        but attempting to open an unwriteable file for output raises
  1023.        SystemCall.
  1024. Status: fixed.
  1025. ---------------------------------------------------------------------------
  1026. 58. incorrect string value in Io_failure exception
  1027. Submitter: dbm
  1028. Date: 11/10/88
  1029. Version: 0.23
  1030. System: vax/v9
  1031. Problem: string returned by Io_failure invoked by open_in is bogus
  1032. Code:
  1033.   [assume "all" is the name of an unreadable file]
  1034.     (open_in "all"; "abc") handle Io_failure s => s;
  1035. Messages:
  1036.     val it = "open_in: open" : string  
  1037. Comments: should be "open_in: all"
  1038. Status: fixed in 0.49.
  1039. ---------------------------------------------------------------------------
  1040. 59. memory fault on sun
  1041. Submitter: Benjamin Pierce, CMU (Benjamin.Pierce@prood.ergo.cs.cmu.edu)
  1042. Date: 10/18/88
  1043. Version: 0.22
  1044. System: Sun 3 / SunOS 4.0 (3.x?)
  1045. Problem: memory fault
  1046. Code: see shamash:/usr/sml/bugs/benli/test1.sml
  1047. Messages: see shamash:/usr/sml/bugs/benli/log1
  1048. Comments: Test program works on Vax
  1049. Status: fixed in 0.24 [bug in polymorphic equality for constructions]
  1050. ---------------------------------------------------------------------------
  1051. 60. floating point coprocessor problem on Sun 3
  1052. Submitter: M. C. Atkins, University of York, UK., ...!ukc!minster!martin
  1053. Date: 10th Nov 1988
  1054. Version: 0.22, 10 October 1988
  1055. System: Sun3/SunOS 3.5
  1056. Problem: sml core dumps with illegal instruction (COPROCESSOR PROTOCOL ERROR)
  1057. Code: (This is what I was given!)
  1058.     val start_seed1 = 0.71573298;
  1059.     val start_seed2 = 0.31872973;
  1060.     val start_seed3 = 0.45832123;
  1061.     
  1062.     val mul1 = 147.0;
  1063.     val mul2 = 375.0;
  1064.     val mul3 = 13.0;
  1065.     
  1066.     
  1067.     fun random seed mul = let val x = seed*mul*3.0
  1068.                            in x - real(floor x)
  1069.                           end;
  1070.     
  1071.     fun randlist seed1 seed2 seed3 0 = [] |
  1072.         randlist seed1 seed2 seed3 n = let val s1 = random seed1 mul1
  1073.                                            val s2 = random seed2 mul2
  1074.                                            val s3 = random seed3 mul3
  1075.                                            val rn = (floor ((random (s1*s2*s3) 743.0)*37.0) )
  1076.                                         in rn::(randlist s1 s2 s3 (n-1))
  1077.                                        end;
  1078.     
  1079.     
  1080.     fun rlist n = randlist start_seed1 start_seed2 start_seed3 n;
  1081.  
  1082. Messages: No compiler messages. At runtime the following is written to the console:
  1083.     sml: USER COPROCESSOR PROTOCOL ERROR
  1084.     trap address 0x34, pid 147, pc = ea92a, sr = 4, stkfmt 9, context 3
  1085.     D0-D7  3 3 196838 f 0 0 1966b0 efffc50
  1086.     A0-A7  efff274 1affec 0 efffd98 efffda4 0 1b0004 efff264
  1087.  
  1088. Comments:
  1089.     To duplicate `use' the given code, and then evaluate `rlist
  1090. 300' two or three times. Typically the first evaluation succeeds, but
  1091. subsequent evaluations fail, giving a core dump (Illegal Instruction)
  1092. and the above error on the console.
  1093.  
  1094.     I have duplicated the behaviour on both a Sun 3/50, and a Sun
  1095. 3/280 - both equipped with MC68881 floating point coprocessors.
  1096. /usr/etc/mc68881version gives the following output:
  1097. on 3/50:
  1098.     MC68881 available; mask set appears to be A93N. 
  1099.     Approximate MC68881 frequency 16.5 MHz.
  1100. on 3/280:
  1101.     MC68881 available; mask set appears to be A93N. 
  1102.     Approximate MC68881 frequency 20.3 MHz. 
  1103. Status: fixed in 0.31
  1104. ---------------------------------------------------------------------------
  1105. 61. lexer bug
  1106. Submitter: Trevor
  1107. Date: 11/6/88
  1108. Version: 0.22
  1109. System: any?
  1110. Problem: illegal character causes loss of next line of input
  1111. Code:
  1112.     - 234;^?                (* That's a true delete (or ^A or whatever) that accidentally *)
  1113.     val it = 234 : int      (* got stuck in there. *)
  1114.     Error: illegal character
  1115.     - "hello";              (* This line gets discarded *)
  1116.     - 3;
  1117.     val it = 3 : int
  1118.     - 
  1119. Comments:
  1120. Status: fixed in 0.24
  1121. ---------------------------------------------------------------------------
  1122. 62. share runtime on SunOS 3.n
  1123. Submitter: Nick
  1124. Date: 10/28/88
  1125. Version: 0.22
  1126. System: Sun 3, SunOS 3.n
  1127. Problem: runtime built with share parameter doesn't work on SunOS 3.n
  1128. Comment: SunOS 3.n object format is not supported
  1129. Status: no action
  1130. ---------------------------------------------------------------------------
  1131. 63. curried, clausal def of infix function
  1132. Submitter: Paulson
  1133. Version: Version 0.20, 13 June 1988
  1134. System: Sun3/SunOS
  1135. Problem: parsing of infixes 
  1136. Code: (minimal code fragment that causes bug)
  1137.     - infix orelf;
  1138.     - fun (f orelf g) x = 0;
  1139.     Error: expected EQUAL, found RPAREN
  1140.     Error: atomic expression expected
  1141.     Error: declaration or expression expected, found RPAREN
  1142.  
  1143.     - fun f orelf g = fn x => 0;
  1144.     val orelf = fn : 'a * 'b -> 'c -> int
  1145. Comments: 
  1146.   This use of an infix in a pattern seems legal and is accepted by Poly/ML.
  1147. Status: fixed in 0.54
  1148. ---------------------------------------------------------------------------
  1149. 64. unclosed comment is not reported
  1150. Submitter: Duba
  1151. Date: 12/2/88
  1152. Version: 0.22 and later
  1153. System: Any
  1154. Problem: unclosed comment is not reported
  1155. Code: (* ...
  1156. Status: fixed in 0.54.
  1157. ---------------------------------------------------------------------------
  1158. 65. arrayoflist should have weak type.
  1159. Submitter: Nick
  1160. Date: 11/24/88
  1161. Version: 0.24
  1162. Status: fixed in 0.33
  1163. ---------------------------------------------------------------------------
  1164. 66. floor(~3.9) gives ~5.
  1165. Submitter: Nick
  1166. Date: 11/24/88
  1167. Version: 0.24
  1168. System: Sun 3
  1169. Status: fixed in 0.33
  1170. ---------------------------------------------------------------------------
  1171. 67. won't parse "fn {x: ty} => x".
  1172. Submitter: Nick
  1173. Date: 11/24/88
  1174. Version: 0.24
  1175. System: Sun 3
  1176. Status: fixed in 0.33
  1177. ---------------------------------------------------------------------------
  1178. 68. spurious error message -- doesn't match sig spec
  1179. Submitter: Nick
  1180. Date: 11/24/88
  1181. Version: 0.24
  1182. System: Sun 3
  1183. Code:
  1184.     - structure S: sig val x: int end = struct val x = hd "s" end;
  1185.     Error: operator and operand don't agree (tycon mismatch)
  1186.       operator domain: 'S list
  1187.       operand:         string
  1188.       in expression:
  1189.         hd "s"
  1190.     Error: value type in structure doesn't match signature spec
  1191.       name: x
  1192.       spec:   int
  1193.       actual: error
  1194. Status: fixed in 0.54
  1195. ---------------------------------------------------------------------------
  1196. 69. printing of exn spec in inferred signature
  1197. Submitter: Nick
  1198. Date: 11/24/88
  1199. Version: 0.24
  1200. System: Sun 3
  1201. Code:
  1202.     - structure Blah = struct exception BLAH end;
  1203.     structure Blah :
  1204.       sig
  1205.         exception BLAH of exn  (* "of exn" should not appear *)
  1206.       end
  1207. Status: fixed in 0.54
  1208. ---------------------------------------------------------------------------
  1209. 70. constructor shouldn't appear in printed structure signature
  1210. Submitter: Nick
  1211. Date: 11/24/88
  1212. Version: 0.24
  1213. System: Sun 3
  1214. Code:
  1215.     signature SIG =
  1216.         sig
  1217.         type t
  1218.         end
  1219.  
  1220.     structure S:SIG =
  1221.         struct
  1222.         datatype t = foo of int
  1223.         val x = 3
  1224.         end
  1225. Messages:
  1226.     structure S :
  1227.         sig
  1228.         datatype t
  1229.           con foo : int -> t  (* shouldn't be printed *)
  1230.         end
  1231. Comment: constructor foo is not accessible as component of S
  1232.     Also, from Dave Berry (2/2/89):
  1233.     NJ ML prints the constructors of a datatype when that datatype is
  1234.     matched against a "type" in a signature, even if the signature
  1235.     doesn't include the constructors.
  1236.  
  1237.     This seems a trivial point (except that it's confusing for the novices on
  1238.     the course we teach).  However, with some complicated programs the compiler
  1239.     bombs out, raising the subscript exception.  You are left in the ML system,
  1240.     but it won't compile your code.
  1241.  
  1242.     I don't have a small example of this.  It first hit me preparing
  1243.     examples for the aforementioned course, and it's just hit me again.
  1244. Status: fixed in 0.56
  1245. ---------------------------------------------------------------------------
  1246. 71. Failure to restore enviroment after exception in "use"
  1247. Submitter: Nick
  1248. Date: 11/24/88
  1249. Version: 0.24
  1250. System: Sun 3
  1251. Code:
  1252.       For a file "y.sml" containing "val y = 4";
  1253.  
  1254.     - val x = (use "y.sml";
  1255.            let exception X in raise X end
  1256.           );
  1257.     [opening y.sml]
  1258.     val y = 4 : int
  1259.     [closing y.sml]
  1260.     uncaught exception X
  1261.     - (* so far so good... *)
  1262.     - x;
  1263.     uncaught exception Runbind
  1264. Comment: needs to be a protect around use to trap exceptions and restore env
  1265. Status: fixed in 0.54
  1266. ---------------------------------------------------------------------------
  1267. 72. equality types with abstype declarations
  1268. Submitter: kevin
  1269. Date: 11/30/88
  1270. Version: 0.24?
  1271. System: Sun 3
  1272. Code:
  1273.     (* The following definition is accepted by the compiler, resulting in
  1274.        the declaration test: ''a foo -> bool *)
  1275.  
  1276.     abstype 'a foo = Foo of 'a list
  1277.     with fun test(Foo x) = (x = []) end;
  1278.  
  1279.     (* The next declaration fails with the error
  1280.       Error: operator and operand don't agree (equality type required)
  1281.       operator domain: ''S * ''S
  1282.       operand:         'T foo * 'U foo
  1283.       in expression:
  1284.     x = Foo nil  *)
  1285.  
  1286.     abstype 'a foo = Foo of 'a list
  1287.     with fun test(x as Foo _) = (x = Foo []) end;
  1288.  
  1289.     (* I'm not sure why one should be allowed and not the other - the old
  1290.        Edinburgh compiler accepted both.  *)
  1291. Status: fixed in 0.54
  1292. ---------------------------------------------------------------------------
  1293. 73. strange function definition
  1294. Submitter: Trevor
  1295. Date: 12/10/88
  1296. Version: 0.24?
  1297. System: vax
  1298. Problem:
  1299. Code:
  1300.     - fun add-a x = x+1;
  1301.     val a = fn : int -> int
  1302.     - a 3;
  1303.     val it = 4 : int
  1304. Comments:
  1305.     The intent was to have a hyphen in a function name
  1306.     (something like "fun add_a ...".
  1307. Status: fixed in 0.54
  1308. ---------------------------------------------------------------------------
  1309. 74. withtype with identity type definition (printing only?)
  1310. Submitter: Nick
  1311. Date: 12/15/88
  1312. Version: 0.22
  1313. Code:
  1314.         - datatype Foo = FOO of Forest
  1315.         =    withtype Forest = Tree list
  1316.         =         and Tree = Foo;
  1317.         datatype  Foo
  1318.         con FOO : Forest -> Foo
  1319.         type  Forest = Tree list
  1320.         type  Tree = Tree               <-= Huh?
  1321. Comments: probably an artifact of printing from symbol table, not abstract syntax
  1322. Status: fixed in 0.54
  1323. ---------------------------------------------------------------------------
  1324. 75. improper type variable causes Substring exception
  1325. Submitter: John Reppy
  1326. Date: 12/17/89
  1327. Version: 0.24
  1328. System: Sun 3
  1329. Code:
  1330.     - (nil : ' list);
  1331.     uncaught exception Substring
  1332. Status: fixed in 0.56
  1333. ---------------------------------------------------------------------------
  1334. 76. parenthesized infix expression in fun lhs
  1335. Submitter: Dave Berry
  1336. Date: 12/22/88
  1337. Version: 0.24?
  1338. Code: 
  1339.     infix o;
  1340.     fun (f o g) x = f (g x);
  1341. Comments: This is correct according to the Definition (according to Berry)
  1342. Status: fixed in 0.54
  1343. ---------------------------------------------------------------------------
  1344. 77. unparenthesized infix expressions in fun lhs
  1345. Submitter: Dave Berry
  1346. Date: 12/22/88
  1347. Version: 0.24?
  1348. Code: 
  1349.     infix 4 %;
  1350.     infix 3 %%;
  1351.  
  1352.     datatype foo = op % of int * int;
  1353.     fun a % b %% c % d = 0;
  1354.  
  1355.     NJ ML accepts this, as does Edinburgh ML.  It is incorrect; brackets
  1356.     are required as follows:
  1357.  
  1358.     fun (a % b) %% (c % d) = 0;
  1359.  
  1360.     This is defined on page 68 of the definition.  The lhs and rhs of the
  1361.     infixed operator being defined are required to be atomic patterns.
  1362. Status: fixed in 0.54
  1363. ---------------------------------------------------------------------------
  1364. 78. bad signature allowed
  1365. Submitter: Nick
  1366. Date: 1/20/89
  1367. Version: 0.24
  1368. Code:
  1369.     signature FRED =
  1370.        sig
  1371.       type Fred
  1372.       val x: 'a Fred
  1373.        end
  1374. Comments: This should be caught as an ill-formed signature
  1375. Status: fixed in 0.39
  1376. ---------------------------------------------------------------------------
  1377. 79. withtype
  1378. Submitter: Simon (from abstract hardware) via Mike Fourman
  1379. Date: 1/31/88
  1380. Version: 0.24
  1381. Problem:
  1382.     "Did you know that the following is not valid ML?
  1383.  
  1384.     datatype type1 = T of type2 * type3
  1385.     withtype type2 = int (* this could be a large expression *)
  1386.     and      type3 = type2 * string;
  1387.  
  1388.     The reason is that the "datatype datbind withtype typbind" construct is
  1389.     expanded out into "datatype datbind'; type typbind" where "datbind'" is
  1390.     the the result of using "typbind" to expand "datbind". Note that this
  1391.     construct does *not* expand "typbind" itself, so "type2" is out of scope
  1392.     in its occurrence in "type3". This simultaneous definition property of
  1393.     "withtype" is quite annoying, especially as there is no way to get the
  1394.     effect of sequential definition (other than manually expanding out the
  1395.     body of "type3" - but that is precisely the problem that "withtype" is
  1396.     supposed to solve)."
  1397.  
  1398. Code:
  1399.     - 
  1400.     datatype type1 = T of type2 * type3
  1401.     withtype type2 = int (* this could be a large expression *)
  1402.     and      type3 = type2 * string;
  1403.  
  1404.  
  1405.     - = = Error: Compiler bug: defineEqTycon/eqtyc 1
  1406.     - 
  1407.     datatype type1 = T of type2 * type3
  1408.     withtype type3 = type2 * string
  1409.     withtype type2 = int (* this could be a large expression *);
  1410.  
  1411.  
  1412.     - = = Error: unbound type constructor (in datatype): type2
  1413.     Error: unbound type constructor (in datatype): type2
  1414.     Error: Compiler bug: defineEqTycon/eqtyc 1
  1415.     - 
  1416. Comment: withtype should have sequential bindings, not simultaneous
  1417. Status: fixed in 0.54
  1418. ---------------------------------------------------------------------------
  1419. 80. simultaneous type declarations
  1420. Submitter: Dave Berry
  1421. Date: 2/1/89
  1422. Version: 0.24
  1423. Code:
  1424.     - type type2 = int
  1425.     = and  type3 = type2 * string;
  1426.     type  type2 = int
  1427.     type  type3 = type2 * string
  1428. Comments:
  1429.     This is wrong: type2 shouldn't be bound before the declaration of type3.
  1430. Status: fixed in 0.54
  1431. ---------------------------------------------------------------------------
  1432. 81. repeated specs in signatures
  1433. Submitter: John Reppy
  1434. Date: 2/12/89
  1435. Version: 0.24
  1436. Problem:
  1437.     I noticed that a signature of the form
  1438.  
  1439.         sig
  1440.             val x : int
  1441.             val x : string
  1442.         end
  1443.  
  1444.     is acceptable.  Although this is in keeping with redeclaration in other
  1445.     scopes, it isn't very useful, and lets detectable errors get by.  I would
  1446.     suggest that redeclaration of identifiers in signatures ought to at least
  1447.     generate a warning message (if not an error).
  1448. Status: same as #4
  1449. ---------------------------------------------------------------------------
  1450. 82. compiler bug caused by type in datatype declaration
  1451. Submitter: Andrew
  1452. Date: 2/20/89
  1453. Version: 0.28?
  1454. Code:
  1455.     datatype a = A of int;
  1456.     datatype b = B of A;                    (* typo for B of a *)
  1457. Messages:
  1458.     Error: unbound type constructor (in datatype): A
  1459.     Error: Compiler bug: defineEqTycon/eqtyc 1.
  1460. Status: fixed in 0.39
  1461. ---------------------------------------------------------------------------
  1462. 83. unexpected parsing of erroneous datatype declaration
  1463. Submitter: Carl Gunter
  1464. Date: 2/24/88
  1465. Version: 0.20
  1466. Code:
  1467.     - datatype complex = Complex (real,real);
  1468.     datatype  complex
  1469.     con Complex : complex
  1470.     val it = (fn,fn) : (int -> real) * (int -> real)
  1471. Comments:
  1472.     implicit "val it = " inserted after constructor Complex breaks the
  1473.     declaration into a valid datatype declaration and a top-level value
  1474.     expression (implicit value declaration).  This could probably be 
  1475.     detected and suppressed.
  1476. Status: fixed in 0.54
  1477. ---------------------------------------------------------------------------
  1478. 84. definition of open_out and open_append
  1479. Submitter: Nick
  1480. Date: 2/28/89
  1481. Version: 0.29
  1482. Problem:
  1483.     the following code from perv.sml is faulty:
  1484.  
  1485.       val open_out = open_o WRITE
  1486.                 handle Assembly.SystemCall s =>
  1487.                     raise Io("open_out: " ^ s)
  1488.       val open_append = open_o APPEND
  1489.                 handle Assembly.SystemCall s =>
  1490.                     raise Io("open_append: " ^ s)
  1491.  
  1492.     Another lambda-abstraction is needed to catch errors on the application
  1493.     of open_o, rather than these bindings.
  1494. Status: fixed in 0.33
  1495. ---------------------------------------------------------------------------
  1496. 85. bad error message for failed signature match
  1497. Submitter: John Reppy
  1498. Date: 3/6/89
  1499. Version: 0.28
  1500. Code:
  1501.    structure Foo : sig
  1502.      type foo
  1503.      val f : foo -> int
  1504.    end = struct
  1505.      type Foo = int
  1506.      fun f x = x
  1507.    end;
  1508. Messages:
  1509.     Error: unmatched type spec: foo
  1510.     tycStamp: INDtyc []
  1511.     Error: Compiler bug: tycStamp
  1512. Status: fixed in 0.54
  1513. ---------------------------------------------------------------------------
  1514. 86. incorrectly allows redefining of "="
  1515. Submitter: Dave Berry
  1516. Date: 3/15/89
  1517. Version: 0.29
  1518. Problem:
  1519.     NJML handles the = symbol incorrectly in some cases.
  1520.  
  1521.     - val op = = op = ;
  1522.     - nonfix =;
  1523.     - = (true, true);
  1524.     Error: declaration or expression expected, found EQUAL
  1525. Comment:
  1526.     The = symbol may not be redefined (Definition, page 4).  The top definition
  1527.     does seem to redefine =, despite the lack of response from the system.
  1528.     I can't see anything in the Definition that forbids making = nonfix,
  1529.     so I suppose it should be possible to use it in a nonfix way.
  1530. Status: fixed by 0.69 (rebinding = gives a warning message; parses better)
  1531. ---------------------------------------------------------------------------
  1532. 87. execute subprocess dies on interrupt on blocked input
  1533. Submitter: dbm
  1534. Date: 3/19/89
  1535. Version: 0.31
  1536. System: Sun3/100, SunOS 4.0.1; VAX8550, V9
  1537. Problem: interrupting blocked call of input from execute subprocess
  1538.      kills subprocesss
  1539. Code:
  1540.     val (ins,outs) = execute "cat"
  1541.     input ins 5;
  1542.     ^Cuncaught exception Interrupt
  1543. Messages:
  1544.    After interrupt, System.system("ps x"), indicates that "cat"
  1545.    subprocess has disappeared, and subsequent attempt to flush output
  1546.    to outs raises exeption Io("output: write failed").
  1547. Comments:
  1548.    end_of_stream also blocks, and interrupting a call of end_of_stream
  1549.    seems to have the same effect.
  1550.  
  1551.    jhr:  This isn't a bug, but rather a "feature."  The sub-process inherits
  1552.     the control terminal (/dev/tty) from its parent.  This means that the
  1553.     SIGINT generated by ^C is passed to both processes.  I assume that
  1554.     there is a work-around, but the semantics are correct for Unix.
  1555. Status: not a bug
  1556. ---------------------------------------------------------------------------
  1557. 88. subscript exception while printing type
  1558. Submitter:
  1559.     Thorsten Altenkirch
  1560.     Technische Universitaet Berlin
  1561.     alti%theo@tub.BITNET
  1562. Date: Fri Mar 31 18:42:20 MET DST 1989
  1563. Version: 0.24
  1564. System: SunOS Release 4.0_Export
  1565. Problem: "uncaught exception Subscript" while printing type.
  1566. Code:
  1567.     signature A = sig type t end;
  1568.     functor F1(a:A) = struct
  1569.       datatype t2 = f of a.t
  1570.       end;
  1571.     functor F2(a:A) = struct
  1572.       structure S = F1(a);
  1573.       open S
  1574.       end;
  1575.     structure SA = struct type t = int end;
  1576.     structure F2SA = F2(SA);
  1577. Messages:
  1578.     ..
  1579.     structure F2SA :
  1580.       sig
  1581.     structure S : sig...end
  1582.     datatype t2
  1583.       con f : [closing /tmp/sml.tmp.l10641]
  1584.     uncaught exception Subscript
  1585. Comments:
  1586.    The error may be caused by the handling of indirect types
  1587.    in src/basics/printtype.sml (printPath).
  1588. Status: fixed in 0.39
  1589. ---------------------------------------------------------------------------
  1590. 89. continuation line string escape at beginning of string
  1591. Submitter: dbm
  1592. Date: 4/3/89
  1593. Version: 0.33
  1594. System: Sun 3, SunOS 4.0.1
  1595. Code:
  1596.     - "\            (* CR after \ at beginning of string *)
  1597.     - akdk";
  1598.     Error: unclosed string
  1599.     =                    (* second CR typed *)
  1600.     Error: unclosed string
  1601.     Error: unbound variable kdk
  1602.     = ;
  1603.     Error: operator is not a function
  1604.       operator: string
  1605.       in expression:
  1606.     "" kdk
  1607. Status: fixed in 0.49.
  1608. ---------------------------------------------------------------------------
  1609. 90. secondary prompt is not set in multi-line strings and comments.
  1610. Submitter: dbm and duba
  1611. Date: 4/3/89
  1612. Version: 0.33
  1613. System: All
  1614. Status: fixed in 0.49
  1615. ---------------------------------------------------------------------------
  1616. 91. misparsing of fun lhs
  1617. Submitter: dbm and duba
  1618. Date: 4/3/89
  1619. Version: 0.33
  1620. System: All
  1621. Code:
  1622.     - fun a+b (x) = a;
  1623.     Error: Compiler bug: generalizeTy -- bad arg
  1624.       b : 'S -> undef
  1625. Status: fixed in 0.54
  1626. ---------------------------------------------------------------------------
  1627. 92. uncaught Nth exception after type constructor arity mismatch in sigmatch
  1628. Submitter: David Tarditi, Princeton University, drt@notecnirp.princeton.edu
  1629. Date: 6/23/89
  1630. Version: 0.33
  1631. System: Vax/4.3 BSD
  1632. Problem: Mismatching arities on types causes uncaught exception Nth
  1633.      later in signature checking.
  1634.  
  1635. Example:
  1636.  
  1637. functor OrdSet(B : sig
  1638.             type elem
  1639.             val gt : elem * elem -> bool
  1640.             val eq : elem * elem -> bool
  1641.            end) =
  1642. struct
  1643. end
  1644.  
  1645. structure Bad =
  1646.     struct
  1647.     type 'a elem = int * 'a
  1648.     val gt = fn ((a:int,_),(b,_)) => a > b
  1649.     val eq = fn ((a:int,_),(b,_)) => a = b
  1650.     end
  1651.  
  1652. structure  X = OrdSet(Bad)
  1653.  
  1654. Result:
  1655.  
  1656. Standard ML of New Jersey, Version 0.33, 1 April 1989
  1657. val it = () : unit
  1658. std_in, line 18: Error: mismatching tycon arities: elem
  1659. uncaught exception Nth
  1660.  
  1661. Comments:
  1662.  
  1663. The uncaught exception Nth appears to occur while matching the actual types
  1664. of eq and gt against the types in the signature of the formal
  1665. structure parameter.
  1666.  
  1667. Status: fixed in 0.56
  1668. ---------------------------------------------------------------------------
  1669. 93. type propagation failure with functor application
  1670. Submitter: David Tarditi, Princeton University, drt@notecnirp
  1671. Date: 7/25/89
  1672. Version: 0.33
  1673. System: Vax/4.3 BSD
  1674. Problem:  Type in a structure passed to a functor remains an opaque
  1675.       type outside the functor.
  1676.  
  1677. Example code:
  1678.  
  1679. signature T =
  1680. sig type 'pos token
  1681. end
  1682.  
  1683. signature L =
  1684. sig structure T : T
  1685. end
  1686.  
  1687. functor P(structure L : L) =
  1688. struct
  1689.     open L
  1690. end
  1691.  
  1692. structure L =
  1693.    struct
  1694.     structure T = struct
  1695.             type 'a token = int * 'a * 'a
  1696.               end
  1697.    end
  1698.  
  1699. structure B = P(structure L = L)
  1700.  
  1701. val x = (5,"","")
  1702. val _ = x : string L.T.token  (* this works *)
  1703. val _ = x : string B.T.token  (* this causes a type error - why ? *)
  1704.  
  1705. Comments:
  1706.  
  1707. I thought that the type token should be an abstract (opaque) type only
  1708. inside the functor P.  It should be non-opaque in the structure created by
  1709. applying the functor P.
  1710.  
  1711. Status: fixed in 0.37
  1712. ---------------------------------------------------------------------------
  1713. 94. uncaught Bind exception parsing functor body
  1714. Submitter: David Tarditi, Princeton University, drt@notecnirp
  1715. Date: 7/25/89
  1716. Version: 0.33
  1717. System: Vax/4.3 BSD
  1718. Problem:  The compiler failed by raising a Bind exception
  1719.       which was not caught.
  1720.  
  1721. Example code:
  1722.  
  1723. functor mkDummy () : sig end  = 
  1724.     struct
  1725.     end
  1726.  
  1727. functor mkLalr () =
  1728.     struct
  1729.     datatype lcore = LCORE of int
  1730.     end
  1731.  
  1732. functor mkTable () =
  1733.    struct
  1734.     structure Dummy = mkDummy()
  1735.     structure Lalr = mkLalr()
  1736.     val x = fn (Lalr.LCORE l) => l
  1737.     end
  1738.  
  1739. Comment:
  1740. It seems that the compiler fails while compiling an access to a data
  1741. constructor inside a functor.  The data constructor must have the
  1742. special characteristic that it is created by applying another functor
  1743. inside the functor being compiled:
  1744.  
  1745. Status: fixed in 0.37 (0 should have been 1 in envaccess.sml *)
  1746. ---------------------------------------------------------------------------
  1747. 95. infix declaration interferes with type parsing
  1748. Submitter: David Tarditi, Princeton University, drt@notecnirp
  1749. Date: 4/30/89
  1750. Version: 0.33
  1751. System: Vax/4.3 BSD
  1752. Problem: Spurious declaration of infix for an identifier causes problems
  1753.      when it is used as a type constructor later.
  1754.  
  1755. Sample Run:
  1756.  
  1757.     Standard ML of New Jersey, Version 0.33, 1 April 1989
  1758.     val it = () : unit
  1759.     - type ('a,'b) --> = 'a -> 'b;
  1760.     type ('a,'b)  --> = 'a -> 'b
  1761.  
  1762.     - val a = fn _ => 5;
  1763.     val a = fn : 'a -> int
  1764.  
  1765.     - a : ('a,int) -->;
  1766.     val it = fn : 'a -> int
  1767.  
  1768.     - infix -->;
  1769.  
  1770.     - a : ('a,int) -->;
  1771.     Error: (user) bound type variable propagated out of scope
  1772.       it : 'aU -> int
  1773.  
  1774. Comments:
  1775.     The declaration of an identifier to be infix should not
  1776. affect type constructors.  Infix declarations apply only to data
  1777. constructors and value identifiers.  The declaration of '-->' to
  1778. be infix should not affect the use of '-->' as a type constructor,
  1779. even though the declaration is spurious.
  1780.  
  1781. P.S.
  1782.     Maybe there should be a way to declare type identifiers to be
  1783. infix.  I was trying to declare '-->' to be infix because I was creating
  1784. different kinds of arrows for my effects inference.  --> could denote
  1785. a function that is pure, while -*-> could denote a function with an
  1786. effect.  I need to do this to bootstrap the pervasive environment
  1787. without assuming that all built-in functions have side-effects.
  1788.  
  1789. Status: fixed in 0.54
  1790. ---------------------------------------------------------------------------
  1791. 96. uncaught exception Unbound parsing signature
  1792. Submitter: Martin Wirsing
  1793. Date: 7/18/89
  1794. Version: 0.33
  1795. System: VAX/V9
  1796. Description: uncaught exception Unbound while parsing a signature
  1797. Code
  1798.  signature Sigtest =
  1799.         sig
  1800.         structure S:
  1801.                 sig
  1802.                 type t1
  1803.                 val x:t1->t1
  1804.                 end
  1805.         structure R:
  1806.                 sig
  1807.                 type t2
  1808.                 val x:t2->t2
  1809.                 end
  1810.         type t
  1811.         val f:t1->R.t2
  1812.         end
  1813. = = = = = = = = = = = = = uncaught exception Unbound
  1814. - Error: declaration or expression expected, found END
  1815.  
  1816. Status: fixed in 0.39
  1817. ---------------------------------------------------------------------------
  1818. 97. Type checking
  1819. Submitter: Mads Tofte
  1820. Date: 6/30/89
  1821. Version: 0.33
  1822. Description:
  1823. Here is a program which, although type correct, does not type check
  1824. on the NJ compiler --- one gets a type error in the last line.  
  1825. It does type check on Poly ML. 
  1826. The problem disappears is one erases the explicit result signature
  1827. on SymTblFct and it seems that the problem is that sharing is
  1828. not propagated correctly in functor application when the signature
  1829. has an explicit result signature.
  1830. When the internal type stamps are printed, one sees that
  1831. the types of the second and the third arguments are ``abstract''
  1832. and not instantiated to the stamps for string and real, respectively.
  1833.  
  1834. Code: 
  1835. signature IntMapSig=
  1836. sig
  1837.   type 'a map
  1838.   exception NotFound
  1839.   val apply: 'a map * int -> 'a
  1840.   val update: 'a map * int * 'a -> 'a map
  1841.   val emptyMap: 'a map
  1842. end;
  1843.  
  1844. signature ValSig =
  1845. sig
  1846.   type value
  1847. end;
  1848.  
  1849. signature SymSig=
  1850. sig
  1851.   eqtype sym
  1852.   val hash: sym -> int
  1853. end;
  1854.  
  1855.  
  1856. functor SymTblFct(
  1857.   structure IntMap: IntMapSig
  1858.   structure Val: ValSig
  1859.   structure Sym: SymSig):
  1860.  
  1861.     sig
  1862.       type table
  1863.       exception Lookup
  1864.       val emptyTable: table
  1865.       val update: table * Sym.sym * Val.value -> table
  1866.     end=
  1867.  
  1868. struct
  1869.   datatype table = TBL of
  1870.    (Sym.sym * Val.value)list IntMap.map
  1871.   val emptyTable = TBL IntMap.emptyMap;
  1872.  
  1873.   exception Lookup
  1874.   
  1875.   fun update(TBL map,s,v)=
  1876.    let val n = Sym.hash(s)
  1877.        val l = IntMap.apply(map,n) handle IntMap.NotFound => []
  1878.        val newmap= IntMap.update(map,n,(s,v)::l)
  1879.     in TBL newmap
  1880.    end 
  1881.  
  1882. end;
  1883.  
  1884. functor FastIntMap(): IntMapSig=
  1885. struct  (* dummy implementation of int maps *)
  1886.   datatype 'a map = N of int * 'a * 'a map * 'a map  
  1887.                   | EMPTY
  1888.   val emptyMap = EMPTY
  1889.   exception NotFound
  1890.   fun apply _ = raise NotFound;
  1891.   fun update _ = raise NotFound;
  1892. end;
  1893.  
  1894. functor ValFct(): ValSig=
  1895. struct 
  1896.   type value = real
  1897. end;
  1898.  
  1899. functor SymFct(): SymSig=
  1900. struct
  1901.   type sym = string
  1902.   fun hash(s:sym)= ord s
  1903. end;
  1904.  
  1905. structure MyTbl=
  1906. SymTblFct(structure IntMap = FastIntMap()
  1907.           structure Val = ValFct()
  1908.           structure Sym = SymFct()
  1909.          );
  1910.               
  1911. open MyTbl;
  1912.   
  1913. update(emptyTable,"ape",10.0);
  1914.  
  1915. Comment: parameters Val and Sym appear in result signature of SymTblFct.
  1916. This has not been supported previously.
  1917.  
  1918. Status: fixed in 0.37
  1919. ---------------------------------------------------------------------------
  1920. 98. eqtype determination
  1921. Submitter: Carl Gunter (gunter@linc.cis.upenn.edu) [Jakov Kucan]
  1922. Date: 7/18/89
  1923. Version: 0.33
  1924. Problem: compiler bug: defineEqTycon/eqtyc 1
  1925. Code:
  1926.  
  1927. datatype constant_type = CONSTANT;
  1928.  
  1929. datatype composed_type = Constructor of int * CONSTANT;
  1930.  
  1931. Messages:
  1932.  
  1933. Standard ML of New Jersey, Version 0.20, 13 June 1988
  1934. val it = () : unit
  1935. - use "bug.ml";
  1936. [opening bug.ml]
  1937. datatype  constant_type
  1938. con CONSTANT : constant_type
  1939. bug.ml, line 7: Error: unbound type constructor (in datatype): CONSTANT
  1940. bug.ml, line 7: Error: Compiler bug: defineEqTycon/eqtyc 1
  1941.  
  1942. Status: fixed in 0.37 
  1943. ---------------------------------------------------------------------------
  1944. 99. include bug
  1945. Submitter: Nick Rothwell
  1946. Date: 7/19/89
  1947. Version: 0.33
  1948. Problem: include doesn't work
  1949. Code:
  1950.     signature A = sig end
  1951.     signature B = sig include A end;
  1952. Messages:
  1953.     Error: Compiler bug: SigMatch.setParent
  1954. Status: fixed in 0.39
  1955. ---------------------------------------------------------------------------
  1956. 100. constructor not printed after open declaration
  1957. Submitter: Nick Rothwell
  1958. Date: 7/18/89
  1959. Version: 0.33
  1960. Problem:
  1961.   In this case, a datatype is being printed as a type: the constructor isn't
  1962.   shown (although it's still bound):
  1963. Code:
  1964.  
  1965.     - signature X = sig datatype T = T end;
  1966.     signature X =
  1967.       sig
  1968.     datatype T
  1969.       con T : T
  1970.       end
  1971.  
  1972.     - structure X: X = struct datatype T = T end;
  1973.     structure X :
  1974.       sig
  1975.     datatype T
  1976.       con T : T
  1977.       end
  1978.  
  1979.     - open X;
  1980.     type  T = T
  1981.  
  1982. Status: fixed in 0.49
  1983. ---------------------------------------------------------------------------
  1984. 101. Duplicate labels (in either types or values) are not detected
  1985. Submitter: Simon Finn (simon%abstract-hardware-ltd.co.uk@nsfnet-relay.ac.uk)
  1986. Date: 7/28
  1987. Version: 0.33
  1988. Code:
  1989.     - {x=1,x=true} : {x:int,x:bool};
  1990.     val it = {x=1,x=true} : {x:int,x:bool}
  1991. Status: fixed in 0.54
  1992. ---------------------------------------------------------------------------
  1993. 102. One-tuples are not printed sensibly.
  1994. Submitter: Simon Finn (simon%abstract-hardware-ltd.co.uk@nsfnet-relay.ac.uk)
  1995. Date: 7/28
  1996. Version: 0.33
  1997. Code:
  1998.     - (* a one-tuple *) {1 = 999};
  1999.     val it = (999) : int
  2000.     - it = 999;
  2001. Messages:
  2002.  Error: operator and operand don't agree (tycon mismatch)
  2003.    operator domain: (int) * (int)
  2004.    operand:         (int) * int
  2005.    in expression:
  2006.      it = 999
  2007. Status: fixed in 0.54
  2008. ---------------------------------------------------------------------------
  2009. 103. Space missing in an error message (which might be more informative).
  2010. Submitter: Simon Finn (simon%abstract-hardware-ltd.co.uk@nsfnet-relay.ac.uk)
  2011. Date: 7/28
  2012. Version: 0.33
  2013. Code:
  2014.    - {999};
  2015. Messages:
  2016.    Error: numeric label abbreviation999
  2017. Status: fixed in 0.54
  2018. ---------------------------------------------------------------------------
  2019. 104. Labels with leading zeroes should not be accepted (this is made
  2020.      explicit on page 5 of version 3 of the Standard).
  2021. Submitter: Simon Finn (simon%abstract-hardware-ltd.co.uk@nsfnet-relay.ac.uk)
  2022. Date: 7/28
  2023. Version: 0.33
  2024. Code:
  2025.     - {0000002 = 999};
  2026.     val it = {2=999} : {2:int}
  2027. Status: fixed in 0.54
  2028. ---------------------------------------------------------------------------
  2029. 105. Large numeric labels are disallowed.    
  2030. Submitter: Simon Finn (simon%abstract-hardware-ltd.co.uk@nsfnet-relay.ac.uk)
  2031. Date: 7/28
  2032. Version: 0.33
  2033. Code:
  2034.     -  {9999999999999999999999 = 999};
  2035. Messages:
  2036.     Error: integer too large
  2037.     Error: nonpositive integer label, found 0
  2038. Status: not important
  2039. ---------------------------------------------------------------------------
  2040. 106. Something strange is happening with "it".
  2041. Submitter: Simon Finn (simon%abstract-hardware-ltd.co.uk@nsfnet-relay.ac.uk)
  2042. Date: 7/28
  2043. Version: 0.33
  2044. Code:
  2045.     Standard ML of New Jersey, Version 0.33, 1 April 1989
  2046.     val it = () : unit
  2047.     - raise it;
  2048.     Error: argument of raise is not an exception
  2049.       raised: unit
  2050.       in expression:
  2051.     raise it
  2052.     - raise it;
  2053.     Error: argument of raise is not an exception
  2054.       raised: unit
  2055.       in expression:
  2056.     raise it
  2057.     - raise it;
  2058.     uncaught exception Runbind
  2059.     - raise it;
  2060.     uncaught exception Runbind
  2061.     - 
  2062. Comment:
  2063.     The problem of an exception leaving the system in an uncertain 
  2064.     state seems to occur in other contexts too.
  2065. Status: fixed in 0.54
  2066. ---------------------------------------------------------------------------
  2067. 107. NJML disappears into an infinite loop when trying to parse large real numbers;
  2068.      presumably some error recovery code is flakey.
  2069. Submitter: Simon Finn (simon%abstract-hardware-ltd.co.uk@nsfnet-relay.ac.uk)
  2070. Date: 7/28
  2071. Version: 0.33
  2072. Code:
  2073.     - 1.0E308;
  2074.     val it = 1.0E308 : real
  2075.     - 1.0E309;
  2076.     Error: Real constant  out of range
  2077.     - 2.0E308; (* wait a long time ... *)
  2078.     val it = uncaught exception Interrupt
  2079.     - 
  2080. Comment:
  2081. Furthermore, a failing program elaboration or evaluation (such as the above)
  2082. should not rebind the variable "it" (ML Standard v3, rules 194 and 195).
  2083. NJML sometimes does (as above).
  2084.  
  2085. Furthermore, trying to print "it" when it has been bound to such an
  2086. exception sometimes seems to crash the system (it refuses to respond to
  2087. further input); at other times the exception Runbind is raised.
  2088.  
  2089. Does anyone know why the largest integer NJML will parse is 1073741775 ?
  2090. This is 2^30 - 49, which seems a funny number to choose. (Mike Crawley
  2091. suggests the fact that 49 is the ASCII code for "1" may be significant.)
  2092.  
  2093. Status: fixed in 0.56
  2094. ---------------------------------------------------------------------------
  2095. 108. More faulty error recovery?
  2096. Submitter: Simon Finn (simon%abstract-hardware-ltd.co.uk@nsfnet-relay.ac.uk)
  2097. Date: 7/28
  2098. Version: 0.33
  2099. Code:
  2100.     - 
  2101.     (* calculates ~ 2^30 *) ~1073741775 - 49;
  2102.  
  2103.     [Increasing heap to 4096k]
  2104.  
  2105.     [Major collection... 99% used (973164/976372), 8020 msec]
  2106.  
  2107.     [Increasing heap to 7568k]
  2108.     val it = uncaught exception Interrupt
  2109.     - 
  2110. Status: fixed in 0.56
  2111. ---------------------------------------------------------------------------
  2112. 109. sharing of datatypes not handled properly
  2113. Submitter: Simon Finn (simon%abstract-hardware-ltd.co.uk@nsfnet-relay.ac.uk)
  2114. Date: 7/28
  2115. Version: 0.33
  2116. Code:
  2117.     signature EQSIG =
  2118.     sig
  2119.       type r
  2120.       datatype s = S of r
  2121.        and t = T of s
  2122.       sharing type r = t
  2123.     end;
  2124.  
  2125.     functor F(X : EQSIG) =
  2126.     struct
  2127.       fun test(x : X.t) = (x = x);
  2128.     end;
  2129. Messages:
  2130.  
  2131.     signature EQSIG =
  2132.       sig
  2133.     type r
  2134.     datatype s
  2135.       con S : r -> s
  2136.     datatype t
  2137.       con T : s -> t
  2138.       end
  2139.     Error: operator and operand don't agree (equality type required)
  2140.       operator domain: ''S * ''S
  2141.       operand:         ?.t * ?.t
  2142.       in expression:
  2143.     x = x
  2144.     Error: Compiler bug: abstractType
  2145.  
  2146. Comment:
  2147.     Both are wrong, as the signature EQSIG elaborates to the same semantic object
  2148.     as the following (which both treat correctly):
  2149.  
  2150.     signature EQSIG =
  2151.     sig
  2152.       type r
  2153.       datatype s = S of t
  2154.        and t = T of s
  2155.       sharing type r = t
  2156.     end;
  2157.  
  2158. Status: fixed in 0.54
  2159. ---------------------------------------------------------------------------
  2160. 110. val rec
  2161. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2162. Date: 7/18/89
  2163. Version: 0.33
  2164. System: Sun3/SunOS 4.0
  2165. Problem: val rec form of definition rejected
  2166. Code:
  2167.  
  2168. - val x = 1 and rec y = fn z => z; (* should compile *)
  2169. Error: expected an atomic pattern, found REC
  2170. Error: expected EQUAL, found REC
  2171. Error: atomic expression expected, found REC
  2172. Error: declaration or expression expected, found REC
  2173.  
  2174. Comment: the compiler should accept the above declaration.
  2175. Status: not a bug; the Definition is silly
  2176. ---------------------------------------------------------------------------
  2177. 111. local polymorphic definitions
  2178. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2179. Date: 7/18/89
  2180. Version: 0.33
  2181. System: Sun3/SunOS 4.0
  2182. Problem: local polymorphic definitions rejected
  2183. Code:
  2184.  
  2185. - val q = let exception x of '_a in 1 handle x _ => 2 end;
  2186. Error: type variable in exception type not weak enough
  2187.  
  2188. - local exception x of '_a in val q = 1 handle x _ => 2 end;
  2189. Error: type variable in exception type not weak enough
  2190.  
  2191.  
  2192. Comment: the compiler should accept both the above definitions,
  2193.          which are valid, since the imperative type variable '_a
  2194.          is *not* free in the top level declaration.
  2195. Comment: (dbm)  Consider the following, which leads to insecurity:
  2196.      local exception X of '_a in val exn0 = X(3) fun h(X(b:bool)) = b end;
  2197.      raise exn0 handle e => h(e);
  2198. Status: not a bug
  2199. ---------------------------------------------------------------------------
  2200. 112. equality
  2201. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2202. Date: 7/18/89
  2203. Version: 0.33
  2204. System: Sun3/SunOS 4.0
  2205. Problem: equality misbehaving
  2206. Code:
  2207.  
  2208. (0.0 = ~0.0, 0.0 = ~ 0.0, ~0.0 = ~ 0.0);    (* (true,true,true) *)
  2209.  
  2210. infix eq; fun x eq y = x = y;
  2211. (0.0 eq ~0.0, 0.0 eq ~ 0.0, ~0.0 eq ~ 0.0); (* (true,false,false) *)
  2212.  
  2213. infix eq; fun (x:real) eq y = x = y;
  2214. (0.0 eq ~0.0, 0.0 eq ~ 0.0, ~0.0 eq ~ 0.0); (* (true,true,true) *)
  2215.  
  2216. Comment: the polymorphic equality function should give
  2217.          consistent results, even when the type of its
  2218.          argument is known to be real.
  2219. Status: fixed in 0.49
  2220. ---------------------------------------------------------------------------
  2221. 113. empty declarations
  2222. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2223. Date: 7/18/89
  2224. Version: 0.33
  2225. System: Sun3/SunOS 4.0
  2226. Problem: Parsing empty declarations
  2227. Code:
  2228.  
  2229.     let val x = 1; (* empty declaration *) ; val y = 2 in x + y end;
  2230.     Error: expected IN, found SEMICOLON
  2231.     Error: atomic expression expected, found SEMICOLON
  2232.     Error: atomic expression expected, found VAL
  2233.     Error: expected END, found VAL
  2234.     Error: declaration or expression expected, found IN
  2235.  
  2236. Comment: the above program is syntactically correct.
  2237. Status: fixed in 0.49
  2238. ---------------------------------------------------------------------------
  2239. 114. include broken (same as bug 99)
  2240. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2241. Date: 7/18/89
  2242. Version: 0.33
  2243. System: Sun3/SunOS 4.0
  2244. Problem: include in signatures
  2245. Code:
  2246.  
  2247.     - signature old = sig type t end;
  2248.     signature old =
  2249.       sig
  2250.     type t
  2251.       end
  2252.  
  2253.     - signature new = sig include old end;
  2254.     Error: Compiler bug: SigMatch.setParent
  2255.  
  2256. Status: fixed in 0.39
  2257. ---------------------------------------------------------------------------
  2258. 115. cyclic signatures
  2259. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2260. Date: 7/18/89
  2261. Version: 0.33
  2262. System: Sun3/SunOS 4.0
  2263. Problem: cyclic signatures
  2264. Code:
  2265.  
  2266.     (* shouldn't be allowed, since object (signature) is not cycle-free *)
  2267.     signature bad =
  2268.     sig
  2269.       structure A :
  2270.       sig
  2271.     structure B : sig end;
  2272.       end;
  2273.       sharing A = A.B;
  2274.     end;
  2275.  
  2276. Comment: NJML accepts the above signature declaration, which should be
  2277.          rejected because it elaborates to a cyclic semantic object;
  2278.          cyclic objects are not semantically admissible.
  2279.  
  2280. Status: not a bug?  (signature will never match a structure)
  2281. ---------------------------------------------------------------------------
  2282. 116. pattern declares no variables warning (?)
  2283. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2284. Date: 7/18/89
  2285. Version: 0.33
  2286. System: Sun3/SunOS 4.0
  2287. Problem: Missing warning message
  2288. Code:
  2289.  
  2290. let val _ = 1 in 2 end;
  2291. local val _ = 1 in val it = 2 end;
  2292.  
  2293.  
  2294. Comment: Each of the above should produce a "Pattern declares
  2295.          no variables" warning message, but neither does.
  2296.  
  2297. Status: not a bug 
  2298. ---------------------------------------------------------------------------
  2299. 117. sharing and equality attributes
  2300. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2301. Date: 7/18/89
  2302. Version: 0.33
  2303. System: Sun3/SunOS 4.0
  2304. Problem: problems with equality attribute
  2305. Code:
  2306.  
  2307. (***************************************************************************)
  2308. (* This is illegal in version 3 of the ML standard                         *)
  2309. (* s may only be elaborated to a non-equality type (+ extra bits)          *)
  2310. (* t may only be elaborated to an equality type (for consistency with its  *)
  2311. (* constructor environment)                                                *)
  2312. (* Hence s and t can't share                                               *)
  2313. (***************************************************************************)
  2314.  
  2315. signature BADSIG =
  2316. sig
  2317.   datatype s = Dummy of bool -> bool
  2318.   datatype t = Dummy of int
  2319.   sharing type s = t;
  2320. end;
  2321.  
  2322. Comment: NJML accepts this signature but shouldn't. Getting the
  2323.          equality attribute right in the presence of sharing
  2324.          constraints seems to be quite a tricky problem.
  2325.  
  2326. Status: fixed in 0.56
  2327. ---------------------------------------------------------------------------
  2328. 118. deviation from Definition, div and mod
  2329. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2330. Date: 7/18/89
  2331. Version: 0.33
  2332. System: Sun3/SunOS 4.0
  2333. Problem: div / mod give non-standard results
  2334. Code:
  2335.  
  2336. fun divmod (m,n) = (m div n,m mod n);
  2337. (* should give (1,2)   *) divmod(5,3);   (* gives (1,2)   *)
  2338. (* should give (~2,1)  *) divmod(~5,3);  (* gives (~1,~2) *)
  2339. (* should give (~2,~1) *) divmod(5,~3);  (* gives (~1,2)  *)
  2340. (* should give (1,~2)  *) divmod(~5,~3); (* gives (1,~2)  *)
  2341.  
  2342. Comments: I'd like the initial dynamic basis to conform to the Standard.
  2343.           (More efficient, non-standard versions should be hidden away.)
  2344. Status: fixed in 0.56
  2345. ---------------------------------------------------------------------------
  2346. 119. deviation from Definition
  2347. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2348. Date: 7/18/89
  2349. Version: 0.33
  2350. System: Sun3/SunOS 4.0
  2351. Problem: I/O functions are curried, Standard has them uncurried
  2352. Code:
  2353.  
  2354.     - input;
  2355.     val it = fn : instream -> int -> string
  2356.  
  2357. Comments: I'd like the initial dynamic basis to conform to the Standard.
  2358.           (More efficient, non-standard versions should be hidden away.)
  2359. Status: fixed in 0.56
  2360. ---------------------------------------------------------------------------
  2361. 120. deviation from Definition
  2362. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2363. Date: 7/18/89
  2364. Version: 0.33
  2365. System: Sun3/SunOS 4.0
  2366. Problem: Prelude functions raise the wrong exceptions
  2367. Code:
  2368.  
  2369.     0.0 / 0.0; (* raises Overflow *)
  2370.     1.0 / 0.0; (* raises Real *)
  2371.  
  2372. Comments: I'd like the initial dynamic basis to conform to the Standard.
  2373.           (More efficient, non-standard versions should be hidden away.)
  2374. This one is even trickier; Poly/ML doesn't raise any exception at all
  2375. for these (it prints NaN.0 and Infinity.0 respectively).
  2376. Status: fixed in 0.56, mostly
  2377. ---------------------------------------------------------------------------
  2378. 121. Unimplemented parts of Standard
  2379. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2380. Date: 7/18/89
  2381. Version: 0.33
  2382. System: Sun3/SunOS 4.0
  2383. Problem: open in signatures apparently unsupported
  2384. Code:
  2385.  
  2386.     - structure old = struct type t = int end;
  2387.     structure old :
  2388.       sig
  2389.     eqtype t
  2390.       end
  2391.     - signature new = sig open old end;
  2392.     Error: expected END, found OPEN
  2393.     Error: declaration or expression expected, found END
  2394.     - 
  2395. Status:  This is a language design problem; see doc/localspec
  2396. ---------------------------------------------------------------------------
  2397. 122. Unimplemented parts of Standard
  2398. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2399. Date: 7/18/89
  2400. Version: 0.33
  2401. System: Sun3/SunOS 4.0
  2402. Problem: let and local for structures apparently unsupported
  2403. Code:
  2404.  
  2405.     - structure Y = struct local val x=1 in structure X = struct val y = 1 end end end;
  2406.     Error: expected END, found STRUCTURE
  2407.     Error: declaration or expression expected, found END
  2408.  
  2409.     - structure Y = let val x=1 in struct structure X = struct val y = 1 end end end;
  2410.     Error: expected a structure-expression, found LET
  2411.     - 
  2412. Status: fixed in 0.54
  2413. ---------------------------------------------------------------------------
  2414. 122. Unimplemented parts of Standard
  2415. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2416. Date: 7/18/89
  2417. Version: 0.33
  2418. System: Sun3/SunOS 4.0
  2419. Problem: local in signature apparently unsupported
  2420. Code:
  2421.  
  2422.     - signature SIG =
  2423.     sig
  2424.       structure S : sig type t end;
  2425.       local open S; in val x : t; end;
  2426.     end;
  2427.     = = = Error: expected END, found LOCAL
  2428.     Error: unbound structure name: S
  2429.     Error: unbound type constructor: t
  2430.     Error: expected EQUAL, found SEMICOLON
  2431.     Error: atomic expression expected, found SEMICOLON
  2432.     - 
  2433. Status: language problem: see doc/localspec
  2434. ---------------------------------------------------------------------------
  2435. 123. error recovery
  2436. Submitter: Simon Finn, Abstract Hardware Ltd, simon@uk.co.ahl
  2437. Date: 18 July 1989
  2438. Version: 0.33
  2439. System: Sun3/SunOS 4.0
  2440. Problem: NJML error recovery is flakey
  2441. Code: 
  2442.     val it = () : unit
  2443.     - infix xxx;
  2444.     - fun (a xxx b) = 3;
  2445.     Error: expected EQUAL, found RPAREN
  2446.     Error: atomic expression expected, found RPAREN
  2447.     Error: declaration or expression expected, found RPAREN
  2448.     - fun output (s,w) = output s w;
  2449.     Error: pattern and expression in val rec dec don't agree (circularity)
  2450.       pattern:    'S -> 'T -> 'U
  2451.       expression: 'S * 'T -> 'U
  2452.       in declaration:
  2453.     output = (fn arg => (case arg
  2454.           of <pat> => <exp>))
  2455.     - output;
  2456.     uncaught exception Runbind
  2457.  
  2458. Comments: The declaration of "xxx" should be accepted - this is a minor
  2459.           known (?) parsing bug. The redeclaration of "output" is a user
  2460.           error. The two in succession seem to severely confuse the
  2461.           compiler; either independently seems to be OK.
  2462. Status: fixed
  2463. ---------------------------------------------------------------------------
  2464. 124. compiler bug after incomplete qualified identifier
  2465. Submitter: David Tarditi, Princeton University, drt@notecnirp
  2466. Date: 4/21/89
  2467. Version: 0.33
  2468. System: Vax/4.3 BSD
  2469. Problem: compiler error results when incomplete qualified identifier is used.
  2470. Sample Run:
  2471.  
  2472.     Standard ML of New Jersey, Version 0.33, 1 April 1989
  2473.     val it = () : unit
  2474.     -Integer.;
  2475.     Error: incomplete qualified identifier
  2476.     Error: Compiler bug: EnvAccess.lookPathinStr.getStr
  2477.     -
  2478.  
  2479. Comments:
  2480. Caused by using an incomplete qualified identifier.
  2481.  
  2482. Status: fixed in 0.56, sort of.
  2483. ---------------------------------------------------------------------------
  2484. 125. constructor exported from abstype declaration
  2485. Submitter: Carl Gunter <gunter@CENTRAL.CIS.UPENN.EDU>
  2486. Date: 6/25/89
  2487. Version: 0.33
  2488. Problem: constructor for abstract type visible outside abstype decl
  2489. Code:
  2490.     abstype
  2491.       intset = Set of int list
  2492.     with
  2493.       val empty_set = Set [];
  2494.     end
  2495.  
  2496.     - Set;
  2497.     val it = fn : int list -> intset
  2498.  
  2499. Status: fixed in 0.39
  2500. ---------------------------------------------------------------------------
  2501. 126.  scope of explicit type variables
  2502. Submitter: Mads Tofte <mads%lfcs.edinburgh.ac.uk@NSFNET-RELAY.AC.UK>
  2503. Date: 7/11/89
  2504. Version: 0.33
  2505. Problem:
  2506. New Jersey ML (Version 33) does not accept the following declarations.
  2507. It complains that a user bound type variable escapes out of scope in `insert'.
  2508. But the scope of ''a and 'b is the whole of the fun declaration.  The problem
  2509. seems to be associated with mutual recursion.
  2510.  
  2511.   type (''a, 'b)map = (''a *  'b) list
  2512.  
  2513.   fun plus(l:(''a,'b)map ,[]: (''a, 'b)map ): (''a, 'b)map = l
  2514.     | plus(l,hd::tl) = plus(insert(l,hd), tl)
  2515.   and insert([], p) = [p]
  2516.     | insert((x,y)::rest, (x',y')) = 
  2517.         if x=x' then (x',y')::rest
  2518.         else (x,y) :: insert(rest,(x',y'));
  2519.  
  2520. Status: fixed in 0.54
  2521. ---------------------------------------------------------------------------
  2522. 127. sharing and equality types
  2523. Submitter: Mads Tofte <mads%lfcs.edinburgh.ac.uk@NSFNET-RELAY.AC.UK>
  2524. Date: 7/11/89
  2525. Version: 0.33
  2526. Problem: 
  2527. New Jersey ML does not accept the following functor declaration (it
  2528. complains that S.x is not of equality type).  According to the
  2529. Definition, two types share only if they have the same name (stamp).
  2530. In particular, since equality is an attribute of type names (Version
  2531. 3, page 16), one admits equality iff the other does (one cannot have
  2532. different ``views'' of equality).  
  2533.  
  2534. Presumably the problem is a bug in the unification of type names.
  2535.  
  2536. Code:
  2537.     functor f(structure S : sig type t val x: t end
  2538.           structure T : sig eqtype t end
  2539.           sharing S = T
  2540.          )=
  2541.     struct val b:bool = S.x = S.x
  2542.     end;
  2543.       
  2544. Status: fixed in 0.54
  2545. ---------------------------------------------------------------------------
  2546. 128. question mark as reserved word
  2547. Submitter: Mads Tofte <mads%lfcs.edinburgh.ac.uk@NSFNET-RELAY.AC.UK>
  2548. Date: 7/11/89
  2549. Version: 0.33
  2550. Problem: 
  2551. New Jersey ML treats ? as a reserved word (it once was).
  2552.  
  2553. Status: fixed in 0.54
  2554. ---------------------------------------------------------------------------
  2555. 129. Bind exception parsing functor  (same as 94)
  2556. Submitter:
  2557.   Hans Bruun
  2558.   Department of Computer Science, Technical University of Denmark
  2559.   hb@iddth.dk
  2560. Date: 9-June-1989
  2561. Version: 0.33
  2562. System: Vax/Ultrix
  2563. Problem: parsing functor raises Bind
  2564. Code:
  2565.   signature S_sig=
  2566.   sig 
  2567.   type 'a T
  2568.   val fs: 'a T -> 'a T
  2569.   end;
  2570.  
  2571.   functor S() =
  2572.   struct
  2573.   datatype 'a T =  C
  2574.   fun fs  (x: 'a T )=  C: 'a T
  2575.   end ;
  2576.  
  2577.   functor F (type t)=
  2578.   struct
  2579.   structure S1: S_sig= S();
  2580.   open S1
  2581.   type  FT = t T
  2582.   fun ff (x : FT)=  fs x
  2583.   end;
  2584.  
  2585. Messages: uncaught exception Bind
  2586. Comments: 
  2587.   Without  ': FT'   or   ': S_sig'   the code is accepted by the compiler.
  2588.  
  2589. Status: Fixed in 0.37
  2590. ---------------------------------------------------------------------------
  2591. 130. compiler bug on functor application
  2592. Submitter:
  2593.   Hans Bruun
  2594.   Department of Computer Science, Technical University of Denmark
  2595.   hb@iddth.dk
  2596. Date: 24-May-1989
  2597. Version: 0.33
  2598. System: Vax/Ultrix
  2599. Code:
  2600.  
  2601.     structure S =
  2602.     struct
  2603.     datatype 'a T =  C
  2604.     fun fs  (x: 'a T)=  x
  2605.     end ;
  2606.  
  2607.     functor F (type t)=
  2608.     struct
  2609.     open S
  2610.     type  FT = t T
  2611.     fun ff (x : FT)=  fs x
  2612.     end;
  2613.  
  2614.     structure SF= F(type t=int);
  2615.  
  2616. Messages: 
  2617.     structure S :
  2618.       sig
  2619.     datatype 'a  T
  2620.       con C : 'a T
  2621.     val fs : 'a T -> 'a T
  2622.       end
  2623.     functor F : <sig>
  2624.     bug.sml, line 15: Error: Compiler bug: SigMatch.applyFunctor/insttyc
  2625.  
  2626. Status: fixed in 0.39
  2627. ---------------------------------------------------------------------------
  2628. 131. dying on files of certain lengths
  2629. Submitter: Jussi Rintanen, Helsinki University of Technology, jur@hutcs.hut.fi
  2630. Date: 15 June 1989
  2631. Version: 0.33 1 April 1989
  2632. System: Vax 4.3 BSD, Sun-4 SunOS Release4-3.2 (?)
  2633. Problem: Neither the batch compiler not the interactive system accept
  2634.      source files of size 2049, 4097, ...(???).
  2635. Code: Tested with 2 signatures, I inserted white space, works properly
  2636.       if the file size is a byte lower or higher.
  2637. Messages: Sun-4 dumps core, uVax raises Io
  2638.  
  2639. Status: fixed in 0.37
  2640. ---------------------------------------------------------------------------
  2641. 132. rebinding of "=" allowed
  2642. Submitter: Mike Fourman (mikef%lfcs.ed.ac.uk)
  2643. Date: 6/8/89
  2644. Version: 0.33
  2645. Problem: NJML allows = to be rebound (contrary to page 4 of the definition)
  2646. Code:
  2647.     - val op = = op < : int * int -> bool;
  2648.     val = = fn : int * int -> bool
  2649.     - 
  2650. Status: not important
  2651. ---------------------------------------------------------------------------
  2652. 133. overloading resolution is weaker than Edinburgh SML or Poly ML
  2653. Submitter: Larry Paulson (lcp@computer-lab.cambridge.ac.uk)
  2654. Date: 5/8/89
  2655. Version: 0.33
  2656. Problem:
  2657. Code:
  2658.     datatype 'a tree = Stree of 'a list * (string * 'a tree) list
  2659.     fun insert ((key::keys, x), Stree(xs,alist)) =
  2660.       let fun inslist((keyi,tri)::alist) =
  2661.             if key<keyi then alist else (keyi,tri) :: inslist alist
  2662.       in  Stree(xs, inslist alist)  end;
  2663. Messages:
  2664.     Error: overloaded variable "<" cannot be resolved
  2665. Status: fixed in 0.54
  2666. ---------------------------------------------------------------------------
  2667. 134. type checking
  2668. Submitter: 
  2669.   Erik Tarnvik 
  2670.   Department of Computing Science
  2671.   University of Umea
  2672.   SWEDEN
  2673.   erikt@cs.umu.se
  2674. Date: 5/12/89
  2675. Version: 0.33
  2676. System: Sun3
  2677. Problem:
  2678. The compiler reports a type clash were it shouldn't.
  2679.  
  2680. Code:
  2681.     type 'a ft = (int * 'a) list;
  2682.  
  2683.     fun f ([]:'a ft) x = []:'a ft
  2684.       | f (((y,fy)::l):'a ft) x = 
  2685.       if x = y
  2686.       then l:'a ft
  2687.       else (y,fy)::(f l x):'a ft
  2688.  
  2689.     and g (l:'a ft) (x,fx) = (x,fx) :: (f l x):'a ft;
  2690.  
  2691. Messages:
  2692.     type 'a  ft = (int * 'a) list
  2693.     line 10: Error: operator and operand don't agree (bound type var)
  2694.       operator domain: (int * 'aU) list
  2695.       operand:         'aU ft
  2696.       in expression:
  2697.     f l
  2698. Comments:
  2699. The Edinburgh SML (ver 3.3) does not report an error on this code.
  2700. If the 'and' in the last line is changed to 'fun', no error is reported.
  2701. I hope I haven't missunderstood something about SML. This is a bug, isn't it?
  2702.  
  2703. Status: fixed in 0.49
  2704. ---------------------------------------------------------------------------
  2705. 135. eqtype vs abstype
  2706. Submitted: Bernard Sufrin (sufrin%prg.oxford.ac.uk@NSFnet-Relay.AC.UK)
  2707. Date: 7/26/89
  2708. Version: 0.33
  2709. Problem: interaction of abstype and eqtype
  2710.  
  2711. I ran into this problem whilst writing you a long note concerning
  2712. abstraction bindings structure bindings and their respect for type and
  2713. eqtype specifications. Here's a miniature version of the larger
  2714. problem.
  2715.  
  2716. We want a pair of types Open and Shut, and transfer functions between
  2717. them. The two signatures below are candidates for describing such a
  2718. structure: the latter leaves visible the equality on Open, the former
  2719. should not.
  2720.  
  2721.     signature T =
  2722.     sig
  2723.       type Shut
  2724.       type Open
  2725.       val Shut:Open->Shut
  2726.       and Open: Shut->Open
  2727.     end
  2728.  
  2729.     signature U =
  2730.     sig
  2731.       type Shut
  2732.       eqtype Open
  2733.       val Shut:Open->Shut
  2734.       and Open: Shut->Open
  2735.     end
  2736.  
  2737. Now we design a functor which simply wraps something up in order to shut it.
  2738.  
  2739.     functor absT(type Open)  =
  2740.     struct
  2741.       type Open = Open
  2742.       abstype Shut = SHUT of Open  with
  2743.     val Shut  = SHUT
  2744.     fun Open(SHUT x) = x
  2745.       end
  2746.     end
  2747.  
  2748. Now we instantiate it:
  2749.  
  2750.     structure b:T = absT(type Open=int)
  2751.  
  2752. Compiler yields:
  2753.  
  2754.     structure b :
  2755.     sig
  2756.       eqtype Shut         <----- can't be right, surely
  2757.       eqtype Open
  2758.       val Open : Shut -> Open
  2759.       val Shut : Open -> Shut
  2760.     end
  2761.  
  2762. The equality on Shut has leaked, despite the fact that the actual
  2763. representation of Shut is an abstype. (The same happens if absT is
  2764. itself constrained to yield a T)
  2765.  
  2766.     - b.Shut 3=b.Shut 4;
  2767.     val it = false : bool
  2768.  
  2769. On the other hand using an abstraction binding
  2770.  
  2771.     abstraction ab:T = absT(type Open=int)
  2772.  
  2773. Compiler yields, correctly,
  2774.  
  2775.     structure ab :
  2776.       sig
  2777.     type Shut
  2778.     type Open
  2779.     val Open : Shut -> Open
  2780.     val Shut : Open -> Shut
  2781.       end
  2782.  
  2783. but I cannot actually apply ab.Shut to an integer (its domain is not
  2784. int, but an opaque and different type, namely ab.Open).  Now let's try
  2785.  
  2786.     abstraction au:U = absT(type Open=int)
  2787.  
  2788. Compiler yields, correctly,
  2789.  
  2790.     structure au :
  2791.     sig
  2792.       type Shut                                    
  2793.       eqtype Open
  2794.       val Open : Shut -> Open
  2795.       val Shut : Open -> Shut
  2796.     end
  2797.  
  2798. but I still can't apply au.Shut to an integer. Incidentally in my
  2799. original note I asked (a) whether I ought to be able to, (b) if so,
  2800. whether eqtype was not getting a bit overloaded [equality visible AND
  2801. representation visible] (c) if not, how could one do this sort of
  2802. thing at all?
  2803.  
  2804. Meanwhile
  2805.  
  2806.     structure argh:U = absT(type Open=int)
  2807.  
  2808. still makes Open and Shut both eqtypes.  More bizarrely, we have
  2809.  
  2810.     abstype opaque = opaque of int with
  2811.      val hide = opaque
  2812.      val show = fn(opaque x)=>x
  2813.     end
  2814.  
  2815.     structure biz:T = absT(type Open=opaque)
  2816.  
  2817. Compiler yields
  2818.  
  2819.     structure biz :
  2820.       sig
  2821.     eqtype Shut                 <--- wow!
  2822.     type Open
  2823.     val Open : Shut -> Open
  2824.     val Shut : Open -> Shut
  2825.       end
  2826.  
  2827. Shut is now an eqtype despite being an abstype whose representation
  2828. includes another abstype!
  2829.  
  2830. Status: fixed in 0.54
  2831. ---------------------------------------------------------------------------
  2832. 136. linkdata problem
  2833. Submitter: John Reppy (ulysses!jhr, jhr@cs.cornell.edu)
  2834. Date: 7/12/89
  2835. Version: 0.36
  2836. System: Sun 3, SunOS 4.0.3
  2837. Problem: failure to build
  2838. Code:
  2839. When I tried to build 0.36 on the sun-3, I got the message
  2840.  
  2841.     ld: : Is a directory
  2842.  
  2843. on the load of the runtime system.  The problem is with the allmo.o
  2844. file.  I am able to build the system using "-noshare".
  2845.  
  2846. Status: fixed in 0.49
  2847. ---------------------------------------------------------------------------
  2848. 137. profiler failure
  2849. Submitter: Ian Dickinson,  HP Labs, Information Systems Centre,    Bristol
  2850.          ijd%otter@hplabs.hp.com
  2851. Date: 9/28/89
  2852. Version: 0.33
  2853. System: HP 9000 HP-UX 6.3
  2854. Problem: 
  2855. I have a small, compute intensive program (around 2K lines of code including
  2856. comments).  With the profiler turned on, njml fails repeatably at the first
  2857. major collect:
  2858.  
  2859.         - test 30 30;
  2860.         Case 30: TOLUENE, A,O-DICHLORO
  2861.  
  2862.         [Major collection... 54% used (2332228/4249436), 2483 msec]
  2863.         unknown signal: 20
  2864.  
  2865.         Process SML exited abnormally with code 148
  2866.  
  2867. Priority: A
  2868. ---------------------------------------------------------------------------
  2869. 138. numeric labels not equivalent to tuples
  2870. Submitter: Russ Green <rjg%lfcs.edinburgh.ac.uk@NSFnet-Relay.AC.UK>
  2871. Date: Thu, 23 Nov 89 11:10:18 GMT
  2872. Version: 0.43
  2873. Problem: numeric labels over 9 not treated properly
  2874. Code:
  2875.  
  2876.     New Jersey ML seems to get confused with records composed of n numeric
  2877.     labels where n > 9.  (Poly ML doesn't)
  2878.  
  2879.       - val a = {1=0,2=0,3=0,4=0,5=0,6=0,7=0,8=0,9=0};
  2880.       val a = (0,0,0,0,0,0,0,0,0) : int * ... * int       (* OK *)
  2881.  
  2882.       - val b = {1=0,2=0,3=0,4=0,5=0,6=0,7=0,8=0,9=0,10=0};
  2883.       val b = {1=0,10=0,2=0,3=0,4=0,5=0,6=0,7=0,8=0,9=0} : 
  2884.            {1:int,10:int,2:int,3:int,4:int,5:int,6:int,7:int,8:int,9:int}
  2885.  
  2886.     The resulting record type will not unify with the corresponding tuple
  2887.  
  2888.       - a = (0,0,0,0,0,0,0,0,0);
  2889.       val it = true : bool            (* OK *)
  2890.  
  2891.       - b = (0,0,0,0,0,0,0,0,0,0);
  2892.      Error: operator and operand don't agree (tycon mismatch)
  2893.      operator domain:{1:int,10:int,2:int,3:int,4:int,5:int,6:int,7:int,8:int,9:int}
  2894.      * {1:int,10:int,2:int,3:int,4:int,5:int,6:int,7:int,8:int,9:int}
  2895.      operand:        {1:int,10:int,2:int,3:int,4:int,5:int,6:int,7:int,8:int,9:int}
  2896.      * (int * int * int * int * int * int * int * int * int * int)
  2897.       in expression:
  2898.     b = (0,0,0,0,0,0,0,0,0,0)
  2899. Comments:
  2900. Presumably something to do with the sorting of the record labels (10 comes
  2901. before 2)?
  2902. Status: fixed in 0.54
  2903. --------------------------------------------------------------------------------
  2904. 139.  compiling with gcc doesn't work 
  2905. Submitter: Brian Boutel, brian@comp.vuw.ac.nz
  2906. Date: 9 November 1989
  2907. Version: 0.36 & later
  2908. System: HP/Sun 3
  2909. Problem: compiling with gcc doesn't work 
  2910. Description:
  2911.  
  2912.     I have been trying again to port sml to H-P 68030 boxes running
  2913.     MORE/bsd, using the Gnu C  compiler. 
  2914.  
  2915.     We have a mix of Sun3 and H-P machines, and, although I have installed
  2916.     sml on the suns, it would be convenient to have it available on the H-Ps as well.
  2917.  
  2918.     The H-P port has not worked, and to separate the problems arising from
  2919.     the Operating System from those arising from the use of gcc, I have
  2920.     tried building sml on the suns with gcc (using the -traditional
  2921.     option). The build completes, but the resulting sml dies immediately
  2922.     while doing a major garbage collection. It does not get as far as
  2923.     announcing itself as Standard ML of .....
  2924.     I have tried various options, (optimiser on/off some of the gcc -f
  2925.     options) without effect. Have you tried gcc? I am anxious to persue
  2926.     this as  I think getting a gcc compiled version to run on the suns is
  2927.     the right first step towards porting to the H-Ps. Can you offer any suggestions?
  2928.  
  2929.     I am using sml version 0.36.  ( I tried today to ftp to
  2930.     research.att.com to check for a later version, but found an empty
  2931.     directory when logging on as anonymous, and was refused permission to
  2932.     log on as mldist.)
  2933.  
  2934.  
  2935.     Changes made to the source are summarised as
  2936.  
  2937.     ------
  2938.     gnu C compiler requires f68881 to be changed to m68881
  2939.     Changed in makeml by introducing $CCOMP, set to GNUCC for machine hp300,
  2940.     otherwise "", and testing it in defining CFL for M68
  2941.  
  2942.     ----------------
  2943.     for H-P, sys/exec.h defines MID_HP300 instead of M_68020
  2944.     linkdata.c and export.c have conditional code if HP300 defined
  2945.     makeml has to pass HP300 to make for linkdata
  2946.     -------------
  2947.     for H-P, callgc.c has FPE_TRAPV_TRAP undefined, and
  2948.     TRAPV returns FPE_INTOVF_TRAP
  2949.     so FPE_TRAPV_TRAP is defined as FPE_INTOVF_TRAP in callgc.c
  2950.     ----------
  2951.     _minitfp_ and _fp_state_mc68881 not defined anywhere for H-P
  2952.     .globl omitted if HP300 in M68.prim.s
  2953.     --------------------
  2954.     run dies because stack clobbered by apply
  2955.     Registers saved ala NeXT/MACH in saveregs/restoreregs in prim.s if GNUCC
  2956. Status: fixed in 0.44
  2957. --------------------------------------------------------------------------------
  2958. 140. comment to end of file  (see also bug 64)
  2959. Submitter: Conal Elliott, Kestrel Institute, conal@kestrel.edu
  2960. Date: Wed Nov  8 11:15:35 1989
  2961. Version: 0.39
  2962. System: Sparc
  2963. Problem: The compiler doesn't give an error message if the file ends in
  2964.          the middle of a comment.
  2965. Messages: None (that's the problem)
  2966. Comments: This has tripped me up a few times, and was quite puzzling.
  2967. Status: fixed in 0.54
  2968. --------------------------------------------------------------------------------
  2969. 141. interrupting gc dumps core
  2970. Submitter: peter@central.cis.upenn.edu (Peter Buneman)
  2971. Date: 18 November 1989
  2972. Version: 0.39
  2973. System: ??
  2974. Problem:
  2975.     I've found occasions on which our current version of ML goes a bit
  2976.     flakey after being interrupted during garbage collection.  I haven't
  2977.     been able to pin it down until now.  The following interactive session
  2978.     appears to be repeatable.
  2979. Code:
  2980.     % sml
  2981.     Standard ML of New Jersey, Version 0.39, 8 September 1989
  2982.     val it = () : unit
  2983.     - fun foo() = 1::foo();
  2984.     val foo = fn : unit -> int list
  2985.     - foo();
  2986.  
  2987.     [Major collection...
  2988.     [Increasing heap to 7144k]
  2989.      70% used (1752720/2487664), 4810 msec]
  2990.  
  2991.     [Increasing heap to 7280k]
  2992.  
  2993.     [Major collection... 62% used (2484132/3975316), 7580 msec]
  2994.           *** I typed <cntrl>C during this garbage collection
  2995.     [Increasing heap to 11648k]
  2996.     uncaught exception Interrupt
  2997.     - fun bar() = bar();
  2998.     val bar = fn : unit -> 'a
  2999.     - bar();      *** I did not type <cntrl>C here !!
  3000.     uncaught exception Interrupt
  3001.     - bar();      *** nor here!!
  3002.     uncaught exception Interrupt
  3003.     - 
  3004. Comments:
  3005.     In 0.43d2 I can't repeat this behavior, but interrupting during gc causes
  3006.     a bus error or segmentation fault. [dbm]
  3007. Status: fixed in 0.54
  3008. --------------------------------------------------------------------------------
  3009. 142. import incompatible with interpreter only image
  3010. Submitter: Bernard Sufrin <sufrin%prg.oxford.ac.uk@NSFnet-Relay.AC.UK>
  3011. Date: 27 Sept 1989
  3012. Version: 0.39
  3013. System: Sun 3 ?
  3014. Problem: import into interpreter
  3015. Description:
  3016.     OK; when making the intepreter-only it seems one must:
  3017.  
  3018.         makeml -noshare -noclean -run
  3019.         makeml -ionly -noshare -norun 
  3020.  
  3021.     Then one gets the smaller (by about 200k) file. 
  3022.  
  3023.     Problem: it is not possible to import precompiled stuff; the compiler 
  3024.     decides that the .bin file is not in the right format; tries to recompile,
  3025.     and fails for lack of a code generator.
  3026.  
  3027.     Here's an example...
  3028.  
  3029.     - import "/prg/pl/sml/lib/lex";
  3030.     [reading /prg/pl/sml/lib/lex.bin... ]
  3031.     [/prg/pl/sml/lib/lex.bin is the wrong format; recompiling]
  3032.     [closing /prg/pl/sml/lib/lex.bin]
  3033.     [reading /prg/pl/sml/lib/lex.sml]
  3034.       [reading /prg/pl/sml/lib/lib/lib/extend.bin... ]
  3035.       [/prg/pl/sml/lib/lib/lib/extend.bin is the wrong format; recompiling]
  3036.       [closing /prg/pl/sml/lib/lib/lib/extend.bin]
  3037.       [reading /prg/pl/sml/lib/lib/lib/extend.sml]
  3038.     /prg/pl/sml/lib/lib/lib/extend.sml, line 52: Error: Compiler bug: no code generator!
  3039.       [closing /prg/pl/sml/lib/lib/lib/extend.sml]
  3040.     [closing /prg/pl/sml/lib/lex.sml]
  3041.     IMPORT failed (compile-time exception: Syntax)
  3042.  
  3043.     When trying to reproduce the import bug
  3044.     you might try making the dependency graph more than three arcs deep.
  3045.  
  3046. Comments:
  3047.     Obviously we don't want to have to dispense with import
  3048.     when using the intepreter-only (typically it'd be students loading
  3049.     precompiled libraries), but I presume we don't want the complication of
  3050.     lambda-formatted bin files as well as machine code bin files.  May I
  3051.     propose the following:
  3052.  
  3053.     import from an ionly system should behave like import in the cg system if
  3054.     everything is up-to-date.
  3055.  
  3056.     if something is out of date, then import should either abort, or behave
  3057.     like use (I prefer the latter, I think, but you might make it
  3058.     controllable from a System.Control variable).
  3059. Status: not important
  3060. --------------------------------------------------------------------------------
  3061. 143. use failes on certain input files of a certain length
  3062. Submitter: Jawahar Malhotra (malhotra%metasoft.uucp@BBN.COM)
  3063. Date: 26 October 1989
  3064. Version: ??
  3065. System: ??
  3066. Problem: use dumping core on magic input file length
  3067. Description:
  3068.     I have a source file which contains a signature definition and a
  3069.     functor definition. When I load it using the "use" statement, the
  3070.     compiler responds with the signature defn and the functor defn but
  3071.     then dumps core just before its prints the [<closing file>] line.
  3072.     Strangely, if I add another blank line to the file, everything is 
  3073.     OK. If you like, I can mail you the file; please let me know if
  3074.     you would like the file.
  3075.  
  3076.     Here is a reproduction of the compiler's output:
  3077.  
  3078.     - use "oareadattr.sml";
  3079.     [opening oareadattr.sml]
  3080.     signature OAREADATTR = ...
  3081.     ...
  3082.     ...
  3083.       end
  3084.     functor OAReadAttrFun : <sig>
  3085.     Segmentation Fault (core dumped)
  3086. Comments:
  3087. Status: not reproducible; possibly fixed.
  3088. --------------------------------------------------------------------------------
  3089. 144. not waiting for child process
  3090. Submitter: Jawahar Malhotra, Meta Software; malhotra%metasoft@bbn.com
  3091. Date: 20 Oct 89
  3092. Version: 0.33
  3093. System: SUN OS 3.5
  3094. Problem:     
  3095.     njsml doesn't wait for child process (created by a call to
  3096.     execute) to terminate. Suppose I execute the following 
  3097.     sml stmt:
  3098.  
  3099.     - execute "ls /users/malhotra";
  3100.  
  3101.     njsml creates a child process in which it runs ls. When ls 
  3102.     is done, it does an exit(0). In order for the exit to
  3103.     complete, its parent process (njsml in this case) should
  3104.     do a wait(). However, njsml doesn't do this and hence the
  3105.     "ls" process blocks on its exit and remains until njsml
  3106.     exits. The state of this process (as displayed by "ps") is:
  3107.  
  3108.     malhotra  2376  0.0  0.1    0    0 p2 Z     0:00 <exiting>
  3109.  
  3110. Comments: 
  3111.     One fix would be to prevent the process created by "execute" from
  3112.     being njsml's child. In this case, njsml would not have to wait to
  3113.     collect the child's termination status. This can be done by
  3114.     forking twice. Hence the code for execute might look like:
  3115.     (assume njsml is process p1)
  3116.  
  3117.     ------------------------------------------------------------
  3118.  
  3119.     /* in process p1 */
  3120.  
  3121.     if (fork() == 0)    {    /* in p2 */
  3122.         if (fork() == 0) {    /* in p3 */
  3123.             .........            
  3124.             execl(......);
  3125.             .......
  3126.         }
  3127.         else {                /* in p2 */
  3128.             exit(0);
  3129.         }
  3130.     }
  3131.     
  3132.     /* in p1 */
  3133.  
  3134.     wait(0);            /* wait for p2 to exit */
  3135.  
  3136.     ------------------------------------------------------------    
  3137.  
  3138.     Another fix (maybe easier to implement) is to install a signal
  3139.     handler for SIGCHLD.
  3140.  
  3141.     signal(SIGCHLD, ack);
  3142.  
  3143.     where ack() is simply:
  3144.  
  3145.     ack()
  3146.     {
  3147.       wait(0);
  3148.     }
  3149. Status: not a bug
  3150. --------------------------------------------------------------------------------
  3151. 145. stale top-level continuations cause type bugs
  3152. Submitter: Andrzej Filinski, CMU Computer Science (andrzej@cs.cmu.edu)
  3153. Date: Oct 11, 1989
  3154. Version: 0.39 (8 September 1989)
  3155. System: Sun3/4.3BSD
  3156. Problem: Capturing top-level continuation messes up the type system
  3157. Code:
  3158.  
  3159.     val cl = ref([]:int cont list);
  3160.     callcc (fn k=>(cl:=[k]; 42));
  3161.     val u = throw (hd (!cl)) 65; (* value 65 with universal type! *)
  3162.     u+1;     (* u as integer *)
  3163.     u^"str"; (* u as string *)
  3164.     u:bool;  (* u as boolean (cannot print) *)
  3165.     u:real;  (* u as real (core dump) *)
  3166.  
  3167. Comments: This may be a tricky problem, i.e. it is not quite clear
  3168. what the "right" behavior should be when the top-level continuation
  3169. is captured and carried across commands. Please don't take this as a
  3170. criticism of callcc/throw in general, though; they're great! Any plans
  3171. for integrating them more deeply in the language, like exceptions?
  3172. Status: fixed in 0.49
  3173. --------------------------------------------------------------------------------
  3174. 146. inputting 1025 characters fails
  3175. Submitter: Jawahar Malhotra, Meta Software, malhotra%metasoft@bbn.com
  3176. Date: 9/29/89
  3177. Version: 0.33
  3178. System: Sun3/SunOS 3.5
  3179. Problem: "input" when applied to std_in and an int > 1024 returns "".
  3180. Code:
  3181.                 - input std_in 1025;
  3182.                 > val it = "" : string
  3183. Comments: It obviously works for all other kinds of instreams.
  3184. Status: fixed in 0.43
  3185. --------------------------------------------------------------------------------
  3186. 147. compiler blowup
  3187. Submitter: Ian Dickinson,  HP Labs, Information Systems Centre,    Bristol
  3188.          ijd%otter@hplabs.hp.com
  3189. Date: 27 Sept 1989
  3190. Version: 0.33
  3191. System: HP 9000 HP-UX 6.3
  3192. Problem: compiler out to lunch
  3193. Description:
  3194.     I have a large-ish list of type:
  3195.         (string * string list) list
  3196.  
  3197.     It has 1003 entries, and on average the string list in each pair is around
  3198.     3 elements.  Each string is between 5 and 9 characters.
  3199.  
  3200.     The list is declared in a file in the form:
  3201.         val graph = [ ("foo", ["bar"]), ... etc ...];
  3202.     This is the only declaration in the file. Poly-ml compiles the file
  3203.     in about 10 seconds.
  3204.  
  3205.     Njml takes around an hour to increase the heap to 30Mbytes, performs several
  3206.     major collects, and then bombs with an out-of-memory error.
  3207. Status: fixed in 0.43
  3208. --------------------------------------------------------------------------------
  3209. 148. relational operators on empty string
  3210. Submitter: jhr@cs.cornell.edu (John Reppy)
  3211.        also Erik Tarnvik, University of Umea, SWEDEN (erikt@cs.umu.se)
  3212. Date: 14 Sept 1989
  3213. Version: 0.39?
  3214. Problem:
  3215.     The implementation of "<" on strings doesn't work for ("" < "").
  3216. Comments:
  3217.     The fix is to replace line 835 of boot/perv.sml, which is
  3218.  
  3219.     fun sgtr(_,"") = true
  3220.  
  3221.     with the lines
  3222.  
  3223.     fun sgtr("","") = false
  3224.       | sgtr(_,"") = true
  3225. Status: fixed in 0.43
  3226. --------------------------------------------------------------------------------
  3227. 149. infinite gc loop with insufficient swap space
  3228. Submitter:  jhr@cs.cornell.edu (John Reppy)
  3229. Date: 18 Sept 89
  3230. Version: 0.39
  3231. System: Vax
  3232. Problem: 
  3233.     SML/NJ is being used at Cornell for a course this semester, and we've
  3234.     run into a problem with it on multi-user vaxen.  If there isn't sufficient
  3235.     swap space for the system to run, it seems to get into an infinite loop
  3236.     of garbage collection attempts.  I should fail gracefully in this situation.
  3237. Status: this is a long, finite loop; not a bug
  3238. --------------------------------------------------------------------------------
  3239. 150. incomplete sharing spec accepted
  3240. Submitter:  Simon Finn <simon%abstract-hardware-ltd.co.uk@NSFnet-Relay.AC.UK>
  3241. Date: 13 Sept 89
  3242. Version: 0.33
  3243. Problem:
  3244.     Both NJML (v0.33) and Poly/ML (v1.80x) erroneously parse the following:
  3245.  
  3246.     signature SIG =
  3247.     sig
  3248.       type t
  3249.       sharing type t
  3250.     end;
  3251. Comments:
  3252.     The above signature is illegal, since sharing constraints must involve
  3253.     at least two types / structures ("n >= 2" in section 3.5, figure 7).
  3254.  
  3255.     This bug was found by Mike Crawley.
  3256. Status: fixed in 0.54
  3257. --------------------------------------------------------------------------------
  3258. 151. can't limit length of list printed
  3259. Submitter:  Lawrence C Paulson <lcp%computer-lab.cambridge.ac.uk@NSFnet-Relay.AC.UK>
  3260. Date: 14 Sept 1989
  3261. Version: ??
  3262. Problem:
  3263.     How do you tell New Jersey ML not to print all the elements of a list?
  3264.     System.Control.Print.printDepth seems to consider nesting only.
  3265. Code:
  3266.     - take(100,ms);
  3267.     val it = [1861294,62685628,105212158,14112418,78287461,35512822,180290056,316473
  3268.     64,72270388,168319897,212829007,43941079,142303594,174252739,117587239,56623288,
  3269.     96050461,46119052,152678905,140061256,13973941,209088847,109015732,167261566,142
  3270.     82215,159257329,69147538,162991570,121739197,19339324,52452037,18146911,23268574
  3271.     ,183534766,93272557,163056892,193407172,50009149,131379349,28143469,114167002,14
  3272.     8862536,85731877,182107423,28619248,67440382,145320439,121674259,172092145,16412
  3273.     2099,196052140,141367123,32002813,17851816,198701119,46866244,196351819,12166451
  3274.     8,163288573,14499193,10976578,64526104,139008271,417145,67962574,64746709,994460
  3275.     5,117181366,115999456,124879621,188830621,158322193,82998094,187333183,178599706
  3276.     ,158794345,17054389,62405431,142521907,182072470,22294474,162171034,163367647,12
  3277.     3860254,25498117,13136599,105899185,53939356,184226566,191249065,66913411,177659
  3278.     797,114495331,28730221,76001191,104114101,180588016,60920215,151887592,208100422
  3279.     ] : int list
  3280.  
  3281.     - [[[[[[[[[[[4]]]]]]]]]]];
  3282.     val it = [[[[[#]]]]] : int list list list list list list list list list list list
  3283.     -
  3284. Status: fixed in 0.54
  3285. --------------------------------------------------------------------------------
  3286. 152. floating point errors
  3287. Submitter: Lawrence C Paulson <lcp%computer-lab.cambridge.ac.uk@NSFnet-Relay.AC.UK>
  3288. Date:  Thu, 14 Sep 89
  3289. Version: ??
  3290. Problem:
  3291.     Why cannot New Jersey handle integers that are well within the maximum
  3292.     available on the hardware?
  3293. Code:
  3294.     - exp(31.0 * ln 2.0);
  3295.     val it = 2147483648.0 : real
  3296.  
  3297.     - floor 2000000000.0;
  3298.     uncaught exception Floor
  3299. Status: fixed in 0.54; but the maximum integer is 1073741823 in SML-NJ
  3300. --------------------------------------------------------------------------------
  3301. 153. interrupting coroutine loop dumps core
  3302. Submitter: Bernard Sufrin <sufrin%prg.oxford.ac.uk@NSFnet-Relay.AC.UK>
  3303. Date:  Sep 15 11:14:13 1989
  3304. Version: 0.43
  3305. System: Sun 3
  3306. Problem: producer consumer segementation fault
  3307.         interrupt consumer(producer) with a single ^c to cause a segmentation
  3308.     fault
  3309. Code:
  3310.     datatype state = S of state cont;
  3311.  
  3312.     fun  resume(S k: state) : state = callcc( fn  k':state cont => throw k (S k'))
  3313.  
  3314.     fun  initiate(p:state -> unit) = callcc( fn  k : state cont => (p(S k); S k))
  3315.  
  3316.     val  buf = ref 0;
  3317.  
  3318.     fun  producer(s:state):unit =
  3319.     let  val  n=ref 0
  3320.     val ccont : state ref = ref(resume s)
  3321.     in
  3322.     while true do (inc n; buf := !n; ccont := resume(!ccont))
  3323.     end
  3324.  
  3325.     fun  consumer(prod: state->unit) : unit =
  3326.     let  val pcont = ref(initiate prod) in
  3327.     while true do (pcont := resume(!pcont); print (!buf))
  3328.     end
  3329. Status: fixed in 0.56
  3330. --------------------------------------------------------------------------------
  3331. 154. import smashing memory
  3332. Submitter: Benjamin Pierce, CMU (bcp@cs.cmu.edu)
  3333. Date: 11/34/89
  3334. Version: 0.41
  3335. System: Sun3/SunOS 3.5.2
  3336. Problem: import seems to be smashing memory
  3337. Comments:
  3338.     I've included a minimal version of program that exercises this bug on
  3339.     my machine.  Slightly different versions give different incorrect
  3340.     results, or simply fail with bus errors.  Removing the first line of
  3341.     tconst.sml (the import of globals, which is never used here) gives the
  3342.     correct answer.
  3343. Transcript:
  3344.     Standard ML of New Jersey, Version 0.41, 25 October 1989
  3345.     val it = () : unit
  3346.     - use "main.sml";
  3347.     [opening main.sml]
  3348.     val it = () : unit
  3349.     [reading checker.sml]
  3350.       [reading tconst.sml]
  3351.     [reading globals.sml]
  3352.     [closing globals.sml]
  3353.     [writing globals.bin... done]
  3354.       [closing tconst.sml]
  3355.       [writing tconst.bin... done]
  3356.     [closing checker.sml]
  3357.     [writing checker.bin... done]
  3358.     signature GLOBALS
  3359.     signature CHECKER
  3360.     signature TCONST
  3361.     functor TConstFun : <sig>
  3362.     functor GlobalsFun : <sig>
  3363.     functor CheckerFun : <sig>
  3364.     structure TConst
  3365.     val it = "\000\^VG\200" : ?.t             <--- Should be "int"
  3366.     [closing main.sml]
  3367.     val it = () : unit
  3368.     - 
  3369. Code:
  3370.     (* ------------------------  globals.sml: ---------------------- *)
  3371.     signature GLOBALS =
  3372.     sig
  3373.       val member: ''a -> ''a list -> bool
  3374.     end
  3375.  
  3376.     functor GlobalsFun() : GLOBALS =
  3377.     struct
  3378.       fun member x [] = false
  3379.         | member x (y::l) = (x=y) orelse (member x l)
  3380.     end
  3381.  
  3382.     (* ------------------------  tconst.sml: ---------------------- *)
  3383.     import "globals";
  3384.  
  3385.     signature TCONST =
  3386.     sig
  3387.       type t
  3388.       val from_string: string -> t
  3389.     end
  3390.  
  3391.     functor TConstFun((*structure Globals:GLOBALS*)): TCONST =
  3392.     struct
  3393.     exception IllegalTConst of string
  3394.     type t = string
  3395.     fun member x [] = false
  3396.       | member x (y::l) = (x=y) orelse (member x l)
  3397.     fun from_string s = if not (member s ["int", "real", "bool"])
  3398.                then raise IllegalTConst(s)
  3399.                else s
  3400.     end
  3401.  
  3402.     (* ------------------------  checker.sml: ---------------------- *)
  3403.     import "tconst";
  3404.     signature CHECKER = sig end (* CHECKER *)
  3405.     functor CheckerFun() : CHECKER = struct end (* CheckerFun *)
  3406.  
  3407.     (* ------------------------  main.sml: ---------------------- *)
  3408.     System.Control.Print.signatures := false;
  3409.     import "checker";
  3410.     (* structure Globals:GLOBALS = GlobalsFun(); *)
  3411.     structure TConst:TCONST = TConstFun((*structure Globals=Globals*));
  3412.     TConst.from_string "int";
  3413. Status: fixed in 0.49
  3414. --------------------------------------------------------------------------------
  3415. 155. Compiler bug caused by of missing structure
  3416. Submitter: Benjamin Pierce (bcp@cs.cmu.edu)
  3417. Date: 11/3/89
  3418. Version: 0.52
  3419. System: Sun3/SunOS
  3420. Problem: Missing structure component shows up later as compiler bug
  3421. Transcript:
  3422.  
  3423.     - use "bug155.sml";
  3424.     bug155.sml:16.1-18.3 Error: unmatched structure spec: A
  3425.     Error: Compiler bug: TypesUtil.lookTycPath.2
  3426.  
  3427. Code: (bug155.sml)
  3428.  
  3429. signature S1 =
  3430. sig
  3431.   type t
  3432. end;
  3433.  
  3434. signature S2 =
  3435. sig
  3436.   structure A : S1
  3437.   val x : A.t
  3438. end;
  3439.  
  3440. structure B : S2 =
  3441. struct
  3442.   val x = 3
  3443. end;
  3444.  
  3445. Status: fixed in 0.54
  3446. --------------------------------------------------------------------------------
  3447. 156. confusing parser error message
  3448. Submitter: dbm
  3449. Date: 4 Nov 1989
  3450. Version: 0.43
  3451. Problem:
  3452.     Misspelled constructor (VALbind instead of VARbind) in line
  3453.  
  3454.       | scan ((VALbind _)::_) = ...
  3455.  
  3456.     causes inappropriate message:
  3457.  
  3458.     basics/typesutil.sml, line 74: Error: identifiers in clauses don't match
  3459. Status: fixed in 0.49
  3460. --------------------------------------------------------------------------------
  3461. 157. nested imports corrupt memory (same as 154?)
  3462. Submitter: sufrin%prg.oxford.ac.uk@NSFnet-Relay.AC.UK
  3463. Date: 3 Nov 89
  3464. Version: 0.39
  3465. System: Sun 3
  3466. Problem:
  3467.     I have had a good deal of trouble with transitive imports. Symptom is
  3468.     segmentation failure on first call of a procedure defined in a functor
  3469.     imported transitively.
  3470.  
  3471.     parser:
  3472.         defines abstractsyntax, lexer, and parser functors
  3473.  
  3474.     codegen:
  3475.         imports parser
  3476.         defines code generator 
  3477.  
  3478.     main:
  3479.         imports codegen
  3480.         instantiates abstractsyntax, lexer, parser
  3481.         crashes at first invocation of procedure defined in parser.
  3482.  
  3483.     When I remove the "import parser" from codegen, and 
  3484.     import it directly from main, then all is well.
  3485.  
  3486.     This actually arose in a student's system, and I haven't time to try it in
  3487.     smaller contexts.  Does the symptom sound familiar? If not, I can send the
  3488.     whole lot to you.
  3489. Status: fixed in 0.49
  3490. --------------------------------------------------------------------------------
  3491. 158. sparc code generator problem
  3492. Submitter: Dale Miller, UPenn, dale@linc.cis.upenn.edu
  3493. Date: 22 Oct 89
  3494. Version: 0.39
  3495. System: Sun4 (unagi.cis.upenn.edu)
  3496. Problem: Error: Compiler bug: [SparcCoder.move]
  3497. Code: /pkg/ml.39/lib/lexgen/lexgen.sml
  3498. Transcript:
  3499.     Standard ML of New Jersey, Version 0.39, 8 September 1989
  3500.     val it = () : unit
  3501.     - use "/pkg/ml.39/lib/lexgen/lexgen.sml";
  3502.     [opening /pkg/ml.39/lib/lexgen/lexgen.sml]
  3503.     /pkg/ml.39/lib/lexgen/lexgen.sml, line 1083: Warning: match not exhaustive
  3504.         (nil,nil) => ...
  3505.         (a :: a',b :: b') => ...
  3506.     /pkg/ml.39/lib/lexgen/lexgen.sml, line 1083: Warning: match not exhaustive
  3507.         1 => ...
  3508.         2 => ...
  3509.         3 => ...
  3510.     /pkg/ml.39/lib/lexgen/lexgen.sml, line 1083: Warning: match not exhaustive
  3511.         (tl,el) :: r => ...
  3512.  
  3513.     [Major collection... 68% used (1443980/2116924), 2760 msec]
  3514.  
  3515.     [Increasing heap to 4576k]
  3516.  
  3517.     [Major collection... 70% used (1724168/2441672), 3170 msec]
  3518.  
  3519.     [Increasing heap to 5520k]
  3520.  
  3521.     [Major collection... 88% used (2573912/2923048), 4620 msec]
  3522.  
  3523.     [Increasing heap to 8040k]
  3524.  
  3525.     [Major collection... 57% used (2395752/4198108), 4320 msec]
  3526.  
  3527.     [Major collection... 68% used (2819788/4139960), 5060 msec]
  3528.  
  3529.     [Increasing heap to 8368k]
  3530.  
  3531.     [Major collection... 78% used (3364372/4305528), 5940 msec]
  3532.  
  3533.     [Increasing heap to 10080k]
  3534.     /pkg/ml.39/lib/lexgen/lexgen.sml, line 1083: Error: Compiler bug: [SparcCoder.move]
  3535.     ?exception Syntax in SparcCM.storeindexl
  3536.     [closing /pkg/ml.39/lib/lexgen/lexgen.sml]
  3537.     -
  3538. Status: fixed in 0.43
  3539. --------------------------------------------------------------------------------
  3540. 159. nested structure reference causes compiler bug
  3541. Submitter: Tom Murtagh, Rice University, tpm@rice.edu
  3542. Date: 10/20/89
  3543. Version: 0.38 and 0.39
  3544. System: Sun4/SunOS 4.0.3c and Sun3/SunOS 4.0.?
  3545. Problem: Compiler dies on reference to type from a nested structure
  3546. Description:
  3547.     I ran into another problem with the compiler.  This one does not
  3548.     appear to have anything to do with the port to SPARC.  I ran it
  3549.     on a Sparcstation using verion 0.38 and on a Sun3 running version
  3550.     0.39 (Bruce's copy) and it died on both.  It compiled without
  3551.     complaint on a Sun 3 running verions 0.33 (which is installed
  3552.     in the public local software directory here).
  3553.  
  3554. Code: (smaller.sml = /usr/sml/bugs/code/bug.159)
  3555.     signature SYMTAB =
  3556.     sig
  3557.         type ident
  3558.     end
  3559.  
  3560.     signature LEX =
  3561.     sig
  3562.         structure Symtab : SYMTAB
  3563.  
  3564.         datatype lexeme =
  3565.         ID of Symtab.ident
  3566.           | DELIM
  3567.     end
  3568.  
  3569.     structure Symtab =
  3570.     struct
  3571.         type ident = string
  3572.     end
  3573.  
  3574.     functor lex( symtab : SYMTAB ) =
  3575.     struct
  3576.         structure Symtab : SYMTAB = symtab
  3577.         datatype lexeme =
  3578.         ID of Symtab.ident
  3579.           | DELIM
  3580.     end
  3581.  
  3582.     structure Lex : LEX = lex( Symtab )
  3583.  
  3584. Transcript:
  3585.     % sml
  3586.     Standard ML of New Jersey, Version 0.38, 23 August 1989
  3587.     val it = () : unit
  3588.     - use "smaller.sml"
  3589.     = ;
  3590.     [opening smaller.sml]
  3591.     signature SYMTAB =
  3592.       sig
  3593.     type ident
  3594.       end
  3595.     signature LEX =
  3596.       sig
  3597.     structure Symtab : sig...end
  3598.     datatype lexeme
  3599.       con DELIM : lexeme
  3600.       con ID : Symtab.ident -> lexeme
  3601.       end
  3602.     structure Symtab :
  3603.       sig
  3604.     eqtype ident
  3605.       end
  3606.     functor lex : <sig>
  3607.     structure Lex :
  3608.       sig
  3609.     structure Symtab : sig...end
  3610.     datatype lexeme
  3611.       con DELIM : lexeme
  3612.       con ID : smaller.sml, line 31: Error: Compiler bug: TypesUtil.lookTycPath.
  3613.     1
  3614.     [closing smaller.sml]
  3615.  
  3616. Status: fixed in 0.43
  3617. --------------------------------------------------------------------------------
  3618. 160. errorty fails to match sig spec 
  3619. Submitter: dbm
  3620. Date: 18 Oct 89
  3621. Version: 0.43
  3622. System: Sun 3
  3623. Problem: error type not matched in checking signature spec
  3624. Messages:
  3625.     typing/functor.sml, line 363: Error: value type in structure doesn't match
  3626.      signature spec
  3627.       name: abstractBody
  3628.       spec: Structure * stampsets -> Structure
  3629.       actual: Structure * error -> Structure
  3630. Status: fixed in 0.54
  3631. --------------------------------------------------------------------------------
  3632. 161. nested functor calls
  3633. Submitter: Don Sannella <dts%lfcs.edinburgh.ac.uk@NSFnet-Relay.AC.UK>
  3634. Date: Tue, 17 Oct 89 18:29:27 BST
  3635. Version: 0.39
  3636. System: Sun 3
  3637. Problem: nested functor calls broken
  3638. Code:
  3639.     signature SIG =
  3640.     sig type t
  3641.     end;
  3642.  
  3643.     functor F(X : SIG) : SIG
  3644.     = struct type t = X.t
  3645.       end;
  3646.  
  3647.     (* Replacing output signature by its definition: no problem *)
  3648.     functor F'(X : SIG) : sig type t end
  3649.     = struct type t = X.t
  3650.       end;
  3651.  
  3652.     functor G(X : SIG) : SIG
  3653.     = struct type t = X.t
  3654.       end;
  3655.  
  3656.     functor H(X : SIG) : SIG = G(F(X));
  3657.  
  3658.     (* Replacing output signature by its definition: fails with exception Bind *)
  3659.     functor H'(X : SIG) : sig type t end = G(F(X));
  3660.     signature SIG =
  3661.     sig type t
  3662.     end;
  3663.  
  3664.     functor F(X : SIG) : SIG
  3665.     = struct type t = X.t
  3666.       end;
  3667.  
  3668.     (* Replacing output signature by its definition: no problem *)
  3669.     functor F'(X : SIG) : sig type t end
  3670.     = struct type t = X.t
  3671.       end;
  3672.  
  3673.     functor G(X : SIG) : SIG
  3674.     = struct type t = X.t
  3675.       end;
  3676.  
  3677.     functor H(X : SIG) : SIG = G(F(X));
  3678.  
  3679.     (* Replacing output signature by its definition: fails with exception Bind *)
  3680.     functor H'(X : SIG) : sig type t end = G(F(X));
  3681. Status: fixed in 0.43
  3682. --------------------------------------------------------------------------------
  3683. 162. ByteArray subscript exception expected
  3684. Submitter:     Jawahar Malhotra, Meta Software Corp., 
  3685.             malhotra%metasoft@bbn.com
  3686. Date:        10/17/89
  3687. Version:     0.33
  3688. System:     Sun OS 3.5
  3689. Problem:     ByteArray.extract doesn't raise Subscript exception when I
  3690.             think it should.
  3691. Code:        
  3692.             val ba = ByteArray.array(4,0);
  3693.             
  3694.             (* I feel that the following SHOULD raise an exception *)
  3695.             ByteArray.extract(ba,4,0);    
  3696.  
  3697.             (* the following two statements CORRECTLY raise exceptions *)
  3698.  
  3699.             ByteArray.extract(ba,5,0);
  3700.             ByteArray.sub(ba,4);
  3701. Status: not a bug
  3702. --------------------------------------------------------------------------------
  3703. 163. function definition syntax
  3704. Submitter: Andy Gordon, Cambridge University, adg@cl.cam.ac.uk
  3705. Date: Mon Oct 16 15:26:44 1989
  3706. Version: Version 0.33, 1 April 1989
  3707. System: Sun
  3708. Problem: another strange function definition
  3709. Code:
  3710.     fun cps-fact n k = cps-fact n k;
  3711. Messages:
  3712.     Error: Compiler bug: generalizeTy -- bad arg
  3713.       fact : 'S -> 'T -> undef
  3714. Comments:
  3715. Like in bug 73, I was mistakenly trying to define a function whose identifier
  3716. contained a hyphen, but this time the compiler complains of a Compiler bug.
  3717.  
  3718. Status: fixed in 0.54
  3719. --------------------------------------------------------------------------------
  3720. 164. NS32 in makeml
  3721. Submitter: Allan E. Johannesen, wpi, aej@wpi.wpi.edu
  3722. Date: 13-Oct-1989
  3723. Version: 0.39, maybe.  That was the number in the README
  3724. System: Encore
  3725. Problem: makeml error
  3726. Code: makeml -encore
  3727. Messages: makeml: must specify machine type
  3728. Comments:
  3729.  
  3730. please put NS32 in $MACHINE case of makeml
  3731.  
  3732. maybe:
  3733.  
  3734.     NS32)
  3735.         if test "$OPSYS" != BSD
  3736.         then
  3737.             echo "makeml: bad os ($OPSYS) for encore"
  3738.             exit 1
  3739.         fi
  3740.         if test -z "$MO"
  3741.         then
  3742.             MO="../mo.encore"
  3743.         fi
  3744.         MODULE="$MODULEKIND"Encore
  3745.     ;;
  3746.  
  3747. Status: no support for NS32, unfortunately
  3748. --------------------------------------------------------------------------------
  3749. 165. NS32 problem in export.c
  3750. Submitter: Allan E. Johannesen, wpi, aej@wpi.wpi.edu
  3751. Date: 13-Oct-1989
  3752. Version: 0.39, maybe.  That was the number in the README
  3753. System: Encore
  3754. Problem: compile error
  3755. Code: makeml -encore
  3756. Messages: "export.c", line 108: Undefined member:  a_syms
  3757. Comments:
  3758.  
  3759. please change:
  3760.  
  3761. #ifndef NS32
  3762.     E.a_syms = 0;
  3763. #endif NS32
  3764.     E.a_syms = 0;
  3765.  
  3766. to:
  3767.  
  3768. #ifndef NS32
  3769.     E.a_syms = 0;
  3770. #endif NS32
  3771.  
  3772. Status: no support for NS32, unfortunately
  3773. --------------------------------------------------------------------------------
  3774. 166. sparc code generator
  3775. Submitter: Konrad Slind <slind%calgary.cdn@relay.CDNnet.CA>
  3776.     (also Soren Christensen, Aarhus, schristensen@daimi.dk)
  3777. Date: 13 Oct 89  0:52 -0600
  3778. Problem:
  3779.   On the Sparcstation 1, under SunOS 4.0.3c, I get the following error:
  3780.  
  3781.     $ sml4
  3782.     Standard ML of New Jersey, Version 0.39, 8 September 1989
  3783.     val it = () : unit
  3784.     - val z = ref " ";
  3785.     val z = ref " " : string ref
  3786.     - z := " ";
  3787.     Error: Compiler bug: [SparcCoder.move]
  3788.     ?exception Syntax in SparcCM.storeindexl
  3789.     - z := "\n";
  3790.     Illegal instruction - core dumped
  3791.     $ 
  3792.  
  3793.   On just a regular old Sun4, under SunOS 4.0.3_Export, the above runs 
  3794.   correctly.
  3795. Status: fixed in 0.43
  3796. --------------------------------------------------------------------------------
  3797. 167. repeated bound type variables in type declaration
  3798. Submitter: Nick Rothwell
  3799. Date: 5 Oct 89
  3800. Version: 0.39?
  3801. System: Sun 3
  3802. Problem: multiple binding occurences of type variable accepted
  3803. Code:
  3804.         - datatype ('a, 'a, 'a) T = A of 'a | B of 'a;
  3805.         datatype ('a,'b,'c)  T
  3806.         con A : 'a -> ('a,'b,'c) T
  3807.         con B : 'a -> ('a,'b,'c) T
  3808. Status: fixed in 0.54
  3809. --------------------------------------------------------------------------------
  3810. 168. profiling on sparc
  3811. Submitter: Tom Murtagh ( tpm@rice.edu)
  3812. Date: Oct 4, 1989
  3813. Version: 0.38
  3814. System: Sun4/SunOS 4.0.3c
  3815. Problem: unhandled exception Match in codegenerator when Profiling enabled
  3816.  
  3817. I stumbled across what appears to be another problem in the Sparc code
  3818. generator.  It seems to fail when any function is compiled with
  3819. profiling enabled.  This time I do have a minimal code fragment:
  3820.  
  3821. % sml
  3822. Standard ML of New Jersey, Version 0.38, 23 August 1989
  3823. val it = () : unit
  3824. -  System.Control.Profile.profiling := true;
  3825. val it = () : unit
  3826. - (fn x => x);
  3827. ?exception Match in SparcCM.storeindexl
  3828. uncaught exception Match
  3829.  
  3830. Status: fixed in 0.43 (?)
  3831. --------------------------------------------------------------------------------
  3832. 169. inferring eqtypes in signatures
  3833. Submitter: Randy Pollack <rap%lfcs.edinburgh.ac.uk@NSFnet-Relay.AC.UK>
  3834. Date: Wed, 27 Sep 89
  3835. Problem: NJML (V0.39) is too liberal in inferring eqtypes in signatures
  3836. Code:
  3837.     - functor F() = struct abstype t = E with val mk_t = E end end;
  3838.     functor F : <sig>
  3839.     - structure f = F();
  3840.     structure f :
  3841.       sig
  3842.     eqtype t            (*** incorrect ***)
  3843.     val mk_t : t
  3844.       end
  3845.  
  3846.     however:
  3847.  
  3848.     - structure f = struct abstype t = E with val mk_t = E end end;
  3849.     structure f :
  3850.       sig
  3851.     type t              (*** correct ***)
  3852.     val mk_t : t
  3853.       end
  3854. Priority: A
  3855. Status: fixed in 0.52
  3856. --------------------------------------------------------------------------------
  3857. 170.  error in makeml script 
  3858. Submitter: sufrin%prg.oxford.ac.uk@NSFnet-Relay.AC.UK
  3859. Date: Wed Sep 27
  3860. Transcript:
  3861. 26 % makeml -sun3 -ionly -o smli -m 3 
  3862. (cd runtime; make clean)
  3863. rm -f *.o lint.out prim.s linkdata allmo.s
  3864. rm -f mo
  3865. ln -s ../mo.m68 mo
  3866. (cd runtime; rm -f run allmo.o)
  3867. (cd runtime; make MACHINE=M68 linkdata)
  3868. cc -O  -DM68  -o linkdata linkdata.c
  3869. runtime/linkdata [runtime/IntNull.mos] > runtime/allmo.o
  3870. (cd runtime; make MACHINE=M68 'DEFS= -DSUN3 -DSUN3 -DBSD' 'CFL=-n -Bstatic -f68881' 'ASMBLR=as')
  3871. cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD  -mc68020 -c  run.c
  3872. cc: Warning: Obsolete option -B
  3873. cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD  -mc68020 -c  gc.c
  3874. cc: Warning: Obsolete option -B
  3875. cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD  -mc68020 -c  callgc.c
  3876. cc: Warning: Obsolete option -B
  3877. /lib/cpp -DM68 -DSUN3 -DSUN3 -DBSD M68.prim.s > prim.s
  3878. as -o prim.o prim.s
  3879. cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD  -mc68020 -c  prof.c
  3880. cc: Warning: Obsolete option -B
  3881. cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD  -mc68020 -c  export.c
  3882. cc: Warning: Obsolete option -B
  3883. cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD  -mc68020 -c  objects.c
  3884. cc: Warning: Obsolete option -B
  3885. cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD  -mc68020 -c  cstruct.c
  3886. cc: Warning: Obsolete option -B
  3887. cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD  -mc68020 -c  trace.c
  3888. cc: Warning: Obsolete option -B
  3889. cc -O -n -Bstatic -f68881 -DM68 -DSUN3 -DSUN3 -DBSD -o run run.o gc.o callgc.o prim.o prof.o export.o objects.o cstruct.o trace.o allmo.o
  3890. cc: Warning: Obsolete option -B
  3891. _Loader: ld: allmo.o: multiply defined
  3892. *** Error code 2
  3893. make: Fatal error: Command failed for target `run'
  3894. echo (System.Control.interp := true; exportML "smli"; output std_out System.version; output std_out "\n"); | runtime/run -m 3 -r 20 -h 2048 IntNull
  3895. makeml: runtime/run: cannot execute
  3896.  
  3897. Status: fixed (or else, old version of SunOS went away)
  3898. --------------------------------------------------------------------------------
  3899. 171. illegal datatype declaration accepted
  3900. Submitter: Russ Green <rjg%lfcs.edinburgh.ac.uk@NSFnet-Relay.AC.UK>
  3901. Date: Tue, 26 Sep 89
  3902. Problem:
  3903.     New Jersey ML (version 0.39) accepts the following (illegal) declaration:
  3904.  
  3905.       datatype t = C1 | C1 of int
  3906.  
  3907.     (rule (30) of the version 3 language definition prohibits any two
  3908.     constructors from having the same identifier)
  3909. Priority: A
  3910. Status: fixed in 0.52
  3911. --------------------------------------------------------------------------------
  3912. 172. functor subscript error
  3913. Submitter: Simon Finn <simon%abstract-hardware-ltd.co.uk@NSFnet-Relay.AC.UK>
  3914. Date: Tue, 26 Sep 89
  3915. Problem:
  3916. The following fragment breaks NJML (v0.39)
  3917.  
  3918.     signature SIG1 =
  3919.     sig
  3920.       type s
  3921.     end;
  3922.  
  3923.     signature SIG2 =
  3924.     sig
  3925.       type t
  3926.       val x : t
  3927.  
  3928.       structure Sub : 
  3929.       sig
  3930.     val f : t -> t
  3931.       end;
  3932.     end;
  3933.  
  3934.     functor F (structure Struct1 : SIG1
  3935.            structure Struct2 : SIG2) =
  3936.     struct
  3937.       val fx = Struct2.Sub.f Struct2.x;
  3938.     end;
  3939.  
  3940. Messages:
  3941.  
  3942.     = = = Error: operator and operand don't agree (tycon mismatch)
  3943.       operator domain: ?.t
  3944.       operand:         ?.t
  3945.       in expression:
  3946.     f x
  3947.     = Error: Compiler bug: abstractType
  3948.  
  3949. Comment:
  3950.     Almost any perturbation of the above seems to make the bug disappear, e.g.
  3951.     (1) removing "structure Struct1 : SIG1"
  3952.     (2) or removing "type s" from SIG1
  3953.     (3) or taking "f" out of "Sub" and putting it at the top level of "Struct2" 
  3954.   [dbm] behavior is different under 43d2.  It produces a lookTycPath subscript
  3955.   exception.
  3956.  
  3957. Priority: A
  3958. Status: fixed in 0.52
  3959. --------------------------------------------------------------------------------
  3960. 173. Runbind
  3961. Submitter: Andrew Tolmach (apt@princeton.edu)
  3962. Date: 31 Aug 89
  3963. Version: ... 0.43
  3964. Problem:
  3965.     - val s = t;
  3966.     Error: unbound variable t
  3967.     - val s = t;
  3968.     Error: unbound variable t
  3969.     - s;
  3970.     uncaught exception Runbind
  3971. Priority: A
  3972. Status: fixed in 0.52
  3973. --------------------------------------------------------------------------------
  3974. 174. import and types
  3975. Submitter:      Lars Bo Nielsen, Aalborg University, Strandvejen 19,
  3976.         9000 Aalborg, DENMARK.
  3977.         Email : lbn@iesd.auc.dk
  3978.  
  3979. Date:        Dec. 4 - 1989
  3980.  
  3981. Version:        0.43
  3982.  
  3983. System:         Sun 3/260 -- SunOs 4.0.1
  3984.         Sun Sparc -- SunOs 4.0.3c        
  3985.  
  3986. Severity:       I think this is VERY critical.
  3987.  
  3988. Problem:        Types of values in Functors is treated differently when
  3989.         imported and used. (Sorry hard to explain, see Code and
  3990.         Transcript).
  3991.         My code that compiled without problem with version 0.42,
  3992.         DIDN't compile under 0.43.
  3993.  
  3994. Code: Refered to as file: pop.sml
  3995. =================================
  3996. signature ASig =
  3997.     sig
  3998.     datatype POP = a | b
  3999.     end
  4000.  
  4001. signature BSig =
  4002.     sig
  4003.     structure DT : ASig
  4004.     val f : DT.POP -> unit
  4005.     end
  4006.  
  4007. functor AFun () : ASig =
  4008.     struct
  4009.     datatype POP = a | b
  4010.     end
  4011.  
  4012. functor BFun (structure DT : ASig) : BSig =
  4013.     struct
  4014.     structure DT = DT
  4015.     open DT
  4016.     val f = fn _ => output std_out "Is Running\n"
  4017.     end
  4018.  
  4019.  
  4020. Transcript: NOTE "<--" are my notes
  4021. ===================================
  4022.  
  4023. Standard ML of New Jersey, Version 0.43, 27 November 1989
  4024. val it = () : unit
  4025. - use "pop.sml";
  4026. [opening pop.sml]            <-- USE the file
  4027. signature ASig =
  4028.   sig
  4029.     datatype POP
  4030.       con a : POP
  4031.       con b : POP
  4032.   end
  4033. signature BSig =
  4034.   sig
  4035.     structure DT : sig...end
  4036.     val f : DT.POP -> unit
  4037.   end
  4038. functor AFun : <sig>
  4039. functor BFun : <sig>
  4040. [closing pop.sml]
  4041. val it = () : unit
  4042. - structure A = AFun();
  4043. structure A :
  4044.   sig
  4045.     datatype POP
  4046.       con a : ?.POP
  4047.       con b : ?.POP
  4048.   end
  4049. - structure B = BFun ( structure DT = A);
  4050. structure B :
  4051.   sig
  4052.     structure DT : sig...end
  4053.     val f : A.POP -> unit            <--- A.POP -> unit
  4054.   end
  4055. - open A;
  4056. type  POP = POP
  4057. - val test = a;
  4058. val test = a : POP
  4059. - B.f test;
  4060. Is Running
  4061. val it = () : unit
  4062. - import "pop";
  4063. [reading pop.bin... done]            <--- IMPORT the file
  4064. signature ASig =
  4065.   sig
  4066.     datatype POP
  4067.       con a : POP
  4068.       con b : POP
  4069.   end
  4070. signature BSig =
  4071.   sig
  4072.     structure DT : sig...end
  4073.     val f : DT.POP -> unit
  4074.   end
  4075. functor AFun : <sig>
  4076. functor BFun : <sig>
  4077. - structure A = AFun();
  4078. structure A :
  4079.   sig
  4080.     datatype POP
  4081.       con a : ?.POP
  4082.       con b : ?.POP
  4083.   end
  4084. - structure B = BFun ( structure DT = A);
  4085. structure B :
  4086.   sig
  4087.     structure DT : sig...end
  4088.     val f : ?.POP -> unit            <-- ?.POP -> unit
  4089.   end
  4090. - open A;
  4091. type  POP = POP
  4092. - val test = a;
  4093. val test = a : POP
  4094. - B.f test;
  4095. Error: operator and operand don't agree (tycon mismatch)
  4096.   operator domain: ?.POP
  4097.   operand:         POP
  4098.   in expression:
  4099.     B.f test
  4100. Comments:    I changed yesterday (Dec 3) from 0.42 to 0.43, and I have 
  4101.         been trying all day (Dec 4) to solve my problem, until I
  4102.         made the little test above. During the solving periode I also
  4103.         had a lot of:
  4104.  
  4105.             ../file, line xxx: Error: structure sharing violation
  4106.  
  4107.         In that periode I was using "import", not "use". These 
  4108.         error messages may show up to be caused by the same bug.
  4109.  
  4110. Fix:         Sorry, I'm not able to fix it. But I hope my example have 
  4111.         given you enough input to track down the bug.
  4112. Status: fixed in 0.53
  4113. ------------------------------------------------------------------------------
  4114. 175. redundant module loading
  4115. Submitter:      Tom Gordon, thomas@gmdzi.uucp
  4116. Date:           6 Mar 90
  4117. Version:        0.44
  4118. System:         Sparc, Sun OS
  4119. Severity:       minor
  4120. Problem:        The module loader reloads functors and signatures
  4121. which have already been loaded. This drastically slows down the edit,
  4122. test, debug cycle.  Shouldn't only those modules be reloaded which
  4123. depend on files which have been, or need to be, recompiled?
  4124. Status: a wish, not a bug (desideratum for sourcegroups)
  4125. ------------------------------------------------------------------------------
  4126. 176. include and sharing
  4127. Submitter: Nick
  4128. Date: 2/26/90
  4129. Version: 0.44
  4130. Problem:
  4131. Poly/ML accepts the following, New Jersey ML (44a) rejects it:
  4132.  
  4133.         signature INCLUDE_1 = sig  type Ty  val x: Ty  end
  4134.         signature INCLUDE_2 = sig  type Ty  val y: Ty  end
  4135.  
  4136.         signature BOTH =
  4137.           sig
  4138.             type T
  4139.             include INCLUDE_1 sharing type Ty = T
  4140.             include INCLUDE_2 sharing type Ty = T
  4141.           end
  4142.  
  4143.         functor F(Both: BOTH) =
  4144.           struct
  4145.             val _ = [Both.x, Both.y]
  4146.           end;
  4147. Comment: exact semantics of include not yet defined
  4148. Status: not a bug
  4149. --------------------------------------------------------------------------------
  4150. 177. clinkdata on sun 3
  4151. Submitter: Dave
  4152. Date: 3/8/90
  4153. Version: 0.52
  4154. System: Sun3, SunOS 4.0.1
  4155. Problem: clinkdata doesn't work
  4156. Transcript:
  4157.     nun% makeml -sun3 -sunos -noclean
  4158.     rm -f mo
  4159.     ln -s ../mo.m68 mo
  4160.     (cd runtime; rm -f run allmo.o)
  4161.     (cd runtime; make -f Makefile MACHINE=M68 'DEFS= -DSUN3 -DBSD' clinkdata)
  4162.     cc -g  -DM68 -DSUN3 -DBSD -o clinkdata clinkdata.c
  4163.     runtime/clinkdata [runtime/IntM68.mos]
  4164.     as: error (runtime/allmo.s:4): Invalid op-code
  4165.     (cd runtime; make -f Makefile MACHINE=M68 'DEFS= -DSUN3 -DBSD' 'CFL=-n -Bstatic
  4166.     -f68881' 'ASMBLR=as' 'WARNPRIM=@:')
  4167.     cc -g -n -Bstatic -f68881 -DM68 -DSUN3 -DBSD -o run run.o gc.o callgc.o M68.dep.
  4168.     o prim.o prof.o export.o objects.o  cstruct.o errstrings.o allmo.o
  4169.     ld: allmo.o: bad string table index (pass 1)
  4170.     *** Error code 4
  4171.     make: Fatal error: Command failed for target `run'
  4172.     echo ( exportML "sml"; output std_out System.version; output std_out (chr 10) (*
  4173.      newline *)); | runtime/run -m 4096 -r 20 -h 2048 IntM68
  4174.     makeml: runtime/run: not found
  4175. Status: fixed in 0.56
  4176. --------------------------------------------------------------------------------
  4177. 178. Missing NS32.dep.c, NS32k port not working
  4178. --------------------------------------------------------------------------------
  4179. 179. compiler bug (783 in sigmatch)
  4180. Submitter: John Reppy
  4181. Date: 2/15/90
  4182. Version: 0.51
  4183. Transcript:
  4184.    - structure A = GG();  (* GG is unbound *)
  4185.    std_in:1.16-1.17 Error: unbound functor identifier: GG
  4186.    Error: Compiler bug: 783 in sigmatch
  4187. Comments: Have to create bogus functor
  4188. Status: fixed in 0.56
  4189. --------------------------------------------------------------------------------
  4190. 180. "sharing violation" error messages not informative
  4191. Submitter: Nick
  4192. Date: 2/15/90
  4193. Version: 0.44
  4194. Problem:
  4195.     ... the diagnostic messages for sharing mismatches are not really
  4196.     useable: having a single message "structure sharing violation" for 100
  4197.     lines of nested functor applications is no use, and I often have to
  4198.     recompile the entire system in Poly/ML just to get more verbose
  4199.     diagnostics with the context of the offending functor application and
  4200.     the names of the offending structures/types.
  4201. Status: fixed before 0.65
  4202. --------------------------------------------------------------------------------
  4203. 181. 8-bit characters not supported in strings
  4204. Submitter: Fritz Ruehr (krf@dip.eecs.umich.edu)
  4205. Date: 2/8/90
  4206. Version: 0.44
  4207. Problem:
  4208.     I am looking to read in 8 bit characters in SML-NJ.  I can get UNIX
  4209.     to pass 8 bits back & forth, and SML-NJ will PRINT strings containing
  4210.     escaped "8-bit characters" (i.e., \nnn) as honest 8-bit output, but for
  4211.     the life of me I cannot get it to READ 8-bit characters when i put them in
  4212.     a string (I get an "Ord exception").  Is this intended behavior?
  4213.     Is there any workaround (say, a switch I didn't notice?)?
  4214. Status: fixed in 0.54
  4215. --------------------------------------------------------------------------------
  4216. 182. uncaught exception after exportFn
  4217. Submitter: Andy Koenig
  4218. Date: 1/31/90
  4219. Version: 0.49 (still in 0.52)
  4220. Problem: 
  4221.   Unwanted uncaught exception message printed after exportFn is called.
  4222. Messages:
  4223.     Standard ML of New Jersey, Version 0.49, 26 January 1990
  4224.     val it = () : unit
  4225.     - fun hello _ = print "hello world\n";
  4226.     val hello = fn : 'a -> unit
  4227.     - exportFn ("a.out", hello);
  4228.  
  4229.     [Major collection... 98% used (492360/498444), 3900 msec]
  4230.  
  4231.     [Major collection... 2% used (13020/494516), 100 msec]
  4232.  
  4233.     [Decreasing heap to 254k]
  4234.     uncaught exception SystemCall with "closed outstream"
  4235. Comments: this can be cosmetically improved, but resumption after
  4236.     an exportFn is not expected to be implemented
  4237. Status: fixed in 0.59
  4238. ------------------------------------------------------------------------------
  4239. 183. "raise" not synchronized with evaluation sequence
  4240. Submitter:      Andrzej Filinski <andrzej@cs.cmu.edu>
  4241. Date:           Jan 20, 1990
  4242. Version:        0.44, 4 December 1989
  4243. System:         VAX, 4.3 BSD (also Sun 3, 4.3 BSD)
  4244. Severity:       minor
  4245. Problem:        "raise" not properly synchronized to expression row evaluation
  4246. Code:           (raise e, s := 2);
  4247. Transcript:     - exception e;
  4248.                 exception e
  4249.                 - val s = ref 0;
  4250.                 val s = ref 0 : int ref
  4251.                 - (s := 1, raise e);
  4252.                 uncaught exception e
  4253.                 - s;
  4254.                 val it = ref 1 : int ref        [OK, did assignment first]
  4255.                 - (raise e, s := 2);
  4256.                 uncaught exception e
  4257.                 - s;
  4258.                 val it = ref 2 : int ref        [did not raise e immediately]
  4259.                 -
  4260. Comments:       This is pathological code, but the Standard does specify
  4261.                 left-to-right evaluation of expression row components.
  4262. Status: fixed (in 0.50?)
  4263. ------------------------------------------------------------------------------
  4264. 184. bindings introduced by open are not printed
  4265. Submitter: Andy Koenig
  4266. Date: 1/30/90
  4267. Version: 0.52
  4268. Problem:
  4269.   After a top level open, the bindings introduced are not printed
  4270. Comment: may provide a separate capability for requesting printing of signatures
  4271.    and other static info.
  4272. Status: not a bug
  4273. --------------------------------------------------------------------------------
  4274. 185. exportML size
  4275. Submitter: Soren Christensen,
  4276.            University of Aarhus, Computer Science Dep.,
  4277.            Denmark
  4278.            schristensen@daimi.dk
  4279. Date:      24 jan 90
  4280. Version:   0.44
  4281. System:    Sun4/280 / SunOS 4.0.1
  4282. Severity:  ???
  4283. Problem:
  4284. Ussualy I have build my application by declaring a number of structures,
  4285. this could be done using less than 45Mb of heapspace, even if I set the
  4286. the flags like:
  4287.  
  4288.  System.Control.CG.reducemore := 0;
  4289.  System.Control.CG.rounds := 10;
  4290.  System.Control.CG.bodysize := 20;
  4291.  
  4292. The system produced from an "exportML" of this takes up app. 3Mb.
  4293.  
  4294. >From "doc/optimize" I learned that the code could be optimized by
  4295. enclosing it in one structure. I did like:
  4296.  
  4297. structure whole :
  4298.   sig
  4299.    < ... >
  4300.   end =
  4301. struct
  4302.  <The usual stuff ..>
  4303. end;
  4304. open whole;
  4305.  
  4306. It meant that the heapsize had to be increased to 80 Mb and I had to reset
  4307. the above flags.
  4308.  
  4309. I observed a bug in the reporting of GC:
  4310. ...
  4311. [Major collection... 76% used (18670576/24426980), 34260 msec]
  4312.  
  4313. [Increasing heap to 59632k]
  4314.  
  4315. [Major collection... -57% used (25033788/31118476), 44190 msec]
  4316.  
  4317. [Increasing heap to 68216k]
  4318.  
  4319. [Major collection... -35% used (30575468/34993364), 54880 msec]
  4320. ...
  4321.  
  4322. The "-57%" should be "80%" and the "-35%" should be "87%".
  4323.  
  4324. But the main problem  is that the CG before the "exportML" only decreases
  4325. the heap to 49Mb, and then it stops with the message "export" - due to no
  4326. disk space (?)
  4327.  
  4328. Comments: (appel)  Setting these flags for optimization may cause the
  4329. code generator to generate very large output.  Use at your own risk.
  4330.  
  4331. Status: can't reproduce; the negative percent messages are fixed in 0.64
  4332. -------------------------------------------------------------------------------
  4333. 186. type error matching against bogus tycon
  4334. Submitter: Dave
  4335. Date: 1/12/90
  4336. Version: 0.52?
  4337. Messages:
  4338.     Error: value type in structure doesn't match signature spec
  4339.       name: instantiate
  4340.       spec: Basics.tyvar * Basics.ty -> unit
  4341.       actual: ?.bogus * ?.bogus -> unit
  4342. Status: can't reproduce
  4343. --------------------------------------------------------------------------------
  4344. 187. parsing clausal definitions with infix functions
  4345. Submitter: Mick Francis
  4346. Date: 1/11/90
  4347. Version: 0.44(?)
  4348. Problem:
  4349.     1) Infix function declarations using parentheses do not parse. E.g.
  4350.         infix xxx;
  4351.         fun (a xxx b)   = b; (* Will not compile *)
  4352.         fun (a xxx b) c = c; (* Will not compile *)
  4353.  
  4354.     2) When an infix identifier appears as the first of more than 2 formal
  4355.        parameters in a function declaration, if the second formal parameter
  4356.        is an identifier, an attempt is made to declare a function with this
  4357.        name. E.g.
  4358.         infix xxx;
  4359.         fun a xxx b c = c;   (* Compiles function b ??? *)
  4360.         fun a xxx nil c = c; (* Tries to bind nil - error *)
  4361.  
  4362.     Gamma% njml
  4363.     Standard ML of New Jersey, Version 0.44a, 13 December 1989
  4364.     val it = () : unit
  4365.     - infix xxx;
  4366.     - fun (a xxx b) y = y; (* Should work *)
  4367.     Error: expected EQUAL, found RPAREN
  4368.     Error: atomic expression expected, found RPAREN
  4369.     Error: declaration or expression expected, found RPAREN
  4370.     - fun (a xxx b) = b; (* Should work *)
  4371.     Error: expected EQUAL, found RPAREN
  4372.     Error: atomic expression expected, found RPAREN
  4373.     Error: declaration or expression expected, found RPAREN
  4374.     - fun a xxx b y = y; (* Shouldn't compile *)
  4375.     val b = fn : 'a -> 'a
  4376.     - fun a xxx nil d = d;
  4377.     Error: improper use of constructor nil in pattern
  4378.     Error: Compiler bug: generalizeTy -- bad arg
  4379.       xxx : 'S * 'T -> undef
  4380.  
  4381.     Incidentally, Poly/ML gets the following wrong :-
  4382.     infix xxx;
  4383.     fun a xxx b d = d;
  4384.  
  4385.     It gives the message :-
  4386.     Error- Constructor (b) has not been declared   Found near b(y)
  4387.  
  4388.     It appears to be looking for a pat, not an atpat on either side of the xxx.
  4389. Status: fixed in 0.52
  4390. --------------------------------------------------------------------------------
  4391. 188. infinite loop parsing simple functor declaration
  4392. Submitter: Simon Finn
  4393. Version: 0.44
  4394. Problem:
  4395.   loops trying to compile the following definitions
  4396. Code:
  4397.     signature TRIVSIG = sig end;
  4398.     functor A(X : TRIVSIG) : TRIVSIG = X;
  4399.     functor B(X : TRIVSIG) : TRIVSIG = A(X);
  4400. Status: fixed in 0.50 or so
  4401. ------------------------------------------------------------------------------
  4402. 189. confusing error message for bad clausal syntax
  4403. Submitter: Carl Gunter
  4404. Date: 1/4/90
  4405. Version: 0.44/0.52
  4406. Problem:
  4407.   Parser error message is not as helpful as it could be.
  4408. Transcript
  4409.     - fun (f:('a pair -> int)) x = 2;
  4410.     std_in:3.5-3.24 Error: illegal function symbol in clause
  4411. Status: fixed 
  4412. --------------------------------------------------------------------------------
  4413. 190. unclosed string in interactive system
  4414. Submitter:      Trevor
  4415. Date:           1/5/90
  4416. Version:        0.44
  4417. System:         SparcStation, SunOs
  4418. Severity:       no prob, bob
  4419. Problem:        error recovery on unclosed string in interactive system
  4420. Transcript:
  4421. - wf "/u/trevor/.login
  4422. = ";                    (* Shouldn't have done this *)
  4423. Error: unclosed string  (* but this warning came too late *)
  4424. = ;
  4425. Error: unclosed string
  4426. Error: operator is not a function
  4427.   operator: unit
  4428.   in expression:
  4429.     wf "" ""
  4430. -
  4431. Comments:       Guess I shouldn't have tried to close the string after
  4432.         I hit return.  But I should have seen an error message
  4433.         so I would know not to do this.  The error message
  4434.         came one line too late.
  4435. Comment by Appel:  The lexer always wants to see the first character of the
  4436. next token before processing the current token; this could be fixed
  4437. but it's not worth it.
  4438. Status: fixed in 0.52 (new parser)
  4439. --------------------------------------------------------------------------------
  4440. 191. Real operators permuted
  4441. Submitter:      Peter Canning <canning@hplabs.hp.com>
  4442. Date:           2 January 1990
  4443. Version:        0.44
  4444. System:         Sun 3 running SUNOS 4.0
  4445. Severity:       critical
  4446. Problem:        Several functions in structure Real are incorrect
  4447. Comments:  order of operations in Real structure was wrong
  4448. Status: fixed in 0.47
  4449. --------------------------------------------------------------------------------
  4450. 192. bad parsing
  4451. Submitter: John Reppy
  4452. Date: 1/6/90
  4453. Version: 0.44
  4454. Transcript:
  4455.   Standard ML of New Jersey, Version 0.44, 4 December 1989
  4456.   val it = () : unit
  4457.   - map fn c => (c, ord c);
  4458.   val it = fn : ('a -> 'b) -> 'a list -> 'b list
  4459.   val it = fn : string -> string * int
  4460. Status: fixed by new parser
  4461. --------------------------------------------------------------------------------
  4462. 193. import types
  4463. Submitter: Nick Rothwell
  4464. Date: 1/5/90
  4465. Version: 0.44a (0.44 with import fix)
  4466. Problem:
  4467.    I've enclosed a bug in NJ SML 0.44a, based on a bug report I received
  4468. from people at HP. I've managed to narrow it down to a simple example.
  4469. It seems to be a strange interaction between the type import code of the
  4470. separate compilation mechanism, the functor typechecking, and the checking
  4471. of record types (of all things!). Unfortunately, I don't know anything about
  4472. how types are imported under separate compilation, so I can't take it much
  4473. further.
  4474. Transcript:
  4475. I enclose two files, A.sml and B.sml. B.sml is a simple script that imports
  4476. A. Try the following: use "B.sml" (so that A gets imported and compiled), and
  4477. then >exit the system<. Start another session and use "B.sml" again. You
  4478. should get the following error:
  4479.  
  4480.         B.sml, line 8: Error: operator and operand don't agree (tycon mismatch)
  4481.           operator domain: {X:'S}
  4482.           operand:         {X:int}
  4483.           in expression:
  4484.             FOO {X=3}
  4485. Code:
  4486.     *** A.sml ***
  4487.     signature A =
  4488.       sig
  4489.     datatype 'a Foo = FOO of {X: 'a}
  4490.         (* Must be a record type to reproduce the bug. *)
  4491.       end;
  4492.  
  4493.     functor A(): A =        (* Must have sig constraint to reproduce the bug *)
  4494.       struct
  4495.     datatype 'a Foo = FOO of {X: 'a}
  4496.       end;
  4497.  
  4498.     *** B.sml ***
  4499.     import "A";
  4500.  
  4501.     structure ??? = A();    (*Needed to reproduce the bug*)
  4502.  
  4503.     functor F(structure A: A) =
  4504.       struct
  4505.     val _ = A.FOO{X=3}
  4506.       end;
  4507.  
  4508. Status: fixed in 0.54, fixed better in 0.57
  4509. --------------------------------------------------------------------------------
  4510. 194. weak type variable syntax 
  4511. Submitter: David Tarditi
  4512. Date: 12/17/89
  4513. Version: 0.44?
  4514. Problem: 
  4515.     There seems to be one slight problem in the documentation on support
  4516.     for imperative type variables as described in the Standard.  I took
  4517.     the documentation to mean that '_a is an abbreviation for '1a.  This
  4518.     isn't true.  If you try the code at the bottom, you'll see this.
  4519. Code:
  4520.     (* Sample code:  The second declaration of y causes a type error *)
  4521.     val x = fn (a,b) => (ref a; ref (a b));
  4522.     val y = x : ('1a -> '1b) * '1a -> '1b ref;
  4523.     val y = x : ('1a -> '1b) * '_a -> '_b ref
  4524. Status: fixed in 0.54
  4525. --------------------------------------------------------------------------------
  4526. 195. Compiler bug: abstractType
  4527. Submitter: John Reppy
  4528. Date: 2/12/89
  4529. Version: 0.28
  4530. Problem:
  4531. I got a compiler bug message when working on my code generator.  Unfortunately
  4532. I wasn't able to reproduce it in a small example.  When I fixed the type error,
  4533. the bug message went away.  I don't know if this is useful to you, but here it is:
  4534. Transcript:
  4535.     - use "sparc/sparccoder.sml";
  4536.     [opening sparc/sparccoder.sml]
  4537.     sparc/sparccoder.sml, line 195: Error: operator and operand don't agree (tyco
  4538. n mismatch)
  4539.     operator domain: register * reg_or_immed * register
  4540.       operand:         register * register * register
  4541.       in expression:
  4542.             emit_subcc (a,b,g0)
  4543.     sparc/sparccoder.sml, line 210: Error: Compiler bug: abstractType
  4544.     [closing sparc/sparccoder.sml]
  4545. Status: probably fixed in 0.54 (can't reproduce)
  4546. --------------------------------------------------------------------------------
  4547. 196. Compiler bug: generalizeTy -- bad arg
  4548. Submitter: Andrew Appel
  4549. Date: 12/6/89
  4550. Version: 0.44
  4551. Problem:
  4552. The following program yields  Compiler bug: generalizeTy -- bad arg
  4553. in version 0.44.
  4554. Code:
  4555. signature COMPLEX =
  4556. sig
  4557.    type elem
  4558.    val complex: real*real -> elem
  4559.    val + : elem * elem -> elem
  4560.    val - : elem * elem -> elem
  4561.    val * : elem * elem -> elem
  4562.    val / : elem * elem -> elem
  4563.    val ~ : elem -> elem   
  4564.    val inv: elem -> elem
  4565.    val abs : elem -> real
  4566.    val conj : elem -> elem
  4567.    val cis: real -> elem
  4568. end
  4569.  
  4570. abstraction Complex : COMPLEX =
  4571. struct
  4572.   open Real
  4573.   type elem = real * real
  4574.   fun complex ri = ri
  4575.   val op + = fn ((a,b),(c,d)) => (a+c,b+d)
  4576.   and op - = fn ((a,b),(c,d)) => (a-c,b-d)
  4577.   and op * = fn ((a,b),(c,d)) => (a*c-b*d, a*d+b*c)
  4578.   and op / = fn ((a,b),(c,d)) => let val z = c*c+d*d
  4579.                   in ((a*c+b*d)/z, (b*c-a*d)/z)
  4580.                  end
  4581.   and inv = fn (a,b) => let val z = a*a+b*b in (a/z,b/z) end
  4582.   and ~ = fn (a,b) => (~a,~b)
  4583.   and abs = fn (a,b) => a*a+b*b
  4584.   and conj = fn (a,b) => (a,~b)
  4585.   and cis = fn t => (cos t, sin t)
  4586. end
  4587.  
  4588. signature FIELD =
  4589. sig
  4590.    type elem
  4591.    val zero: elem
  4592.    val one: elem
  4593.    val + : elem * elem -> elem
  4594.    val * : elem * elem -> elem
  4595.    val inv: elem -> elem
  4596. end
  4597.  
  4598. signature POLYNOMIAL =
  4599. sig
  4600.     structure F : FIELD
  4601.     type poly
  4602.     val x : poly
  4603.     val const : F.elem -> poly
  4604.     val * : poly * poly -> poly
  4605.     val + : poly * poly -> poly
  4606.     val ~ : poly -> poly
  4607.     val eval: poly -> F.elem -> F.elem
  4608.     val deriv: poly -> poly
  4609. end
  4610.  
  4611. functor Polynomial(F : FIELD) : POLYNOMIAL =
  4612. struct
  4613.   structure F=F
  4614.   type poly = F.elem list
  4615.   val x = [F.zero,F.one]
  4616.   fun const c = [c]
  4617.   fun []+a = a
  4618.     | a+[] = a
  4619.     | (a::b) + (c::d) = F.+(a,c)::(b+d)
  4620.   fun scalarmult(a,[]) = []
  4621.     | scalarmult(a,b::c) = a*b::scalarmult(a,c)
  4622.   fun []*a = []
  4623.     | a*[] = []
  4624.     | a::b*c = scalarmult(a,c) + (F.zero::(b*c))
  4625.   fun ~ [] = []
  4626.     | ~ (a::b) = F.~(a) :: ~(b)
  4627.   fun eval p x =
  4628.     let fun f([],z,sum) = sum
  4629.           | f(a::b,z,sum) = f(b,F.*(x,z),sum+F.*(a,z))
  4630.      in f(p,F.one,F.zero)
  4631.     end
  4632.   fun deriv [] = []
  4633.     | deriv a::r =
  4634.     let fun f(z,a::b) = F.*(z,a)::f(F.+(z,F.one),b)
  4635.      in f(F.one,r)
  4636.     end
  4637. end
  4638.  
  4639. abstraction P = Polynomial(Complex)
  4640.  
  4641. Status: fixed in 0.52
  4642. --------------------------------------------------------------------------------
  4643. 197. exportFn size
  4644. Submitter:      Lars Bo Nielsen, Aalborg University, Strandvejen 19,
  4645.                 9000 Aalborg, DENMARK.
  4646.                 Email : lbn@iesd.auc.dk
  4647.  
  4648. Date:           Dec. 6 - 1989
  4649. Version:        0.43
  4650. System:         Sun 3/60 -- SunOs 4.0.3
  4651. Severity:       Depends on the the importness of the the noshare
  4652.                 version of the compiler and exportFn
  4653.  
  4654. Problem:        I make standalone versions of the lex and yacc,
  4655.                 included in the distribution. I use the following
  4656.                 code, to make a standalone version of "smlyacc", and
  4657.                 similar for my "smllex" (feeding it to the noshare
  4658.                 version of sml):
  4659.  
  4660.                 | use "load.sml";
  4661.                 | loadAll();
  4662.                 | open ParseGen;
  4663.                 |
  4664.                 | fun main (argv, env) =
  4665.                 |     let
  4666.                 |         val argc = length argv
  4667.                 |         val prog = hd argv
  4668.                 |     in
  4669.                 |         (if (argc <> 2) then
  4670.                 |             outputc std_out ("Usage: " ^ prog ^ " file\n")
  4671.                 |          else
  4672.                 |              let
  4673.                 |                  val file = hd (tl argv)
  4674.                 |              in
  4675.                 |                   parseGen file
  4676.                 |                   handle Io s =>
  4677.                 |                       outputc std_out
  4678.                 |                           (prog ^ ": Couldn't open file: "
  4679.                 |                            ^ file ^ "\n")
  4680.                 |              end;
  4681.                 |              outputc std_out "\n")
  4682.                 |     end;
  4683.                 |
  4684.                 | exportFn ("smlyacc", main);
  4685.  
  4686.                 The problem then is this: When making "smllex"
  4687.                 everything works fine, and I get (on Sun 3/60) a
  4688.                 standalone version of 208K. But the "smlyacc" version,
  4689.                 though it compiles fine and runs, on more than 2000K.
  4690.  
  4691.                 I used the same procedure with version 0.39, and the
  4692.                 standalone version of "smlyacc" then was 368K.
  4693.  
  4694.                 It seems to me that when exporting "smlyacc", the
  4695.                 runtime system isn't thrown away, as when "smllex"
  4696.                 was generated.
  4697.  
  4698. Status:  fixed in 0.54
  4699. --------------------------------------------------------------------------------
  4700. 198. printing exception specs in signatures
  4701. Submitter: John Reppy
  4702. Date: 12/2/89
  4703. Version: 0.43
  4704. Problem:
  4705.    nullary exceptions get printed as "of exn" in signatures
  4706. Transcript:
  4707.   Standard ML of New Jersey, Version 0.43, 27 November 1989
  4708.   val it = () : unit
  4709.   - signature S = sig exception Sync end;
  4710.   signature S =
  4711.     sig
  4712.       exception Sync of exn
  4713.     end
  4714.   - exception Sync;
  4715.   exception Sync
  4716. Status: fixed in 0.52
  4717. --------------------------------------------------------------------------------
  4718. 199. Compiler bug after unbound signature
  4719. Submitter: John Reppy
  4720. Date: 12/1/89
  4721. Version: 0.43, 0.52
  4722. Problem:
  4723.    Missing signature causes Compiler bug error after unbound signature error.
  4724. Transcript:
  4725.     - signature SS = sig structure A : AA end;
  4726.     std_in:5.34-5.35 Error: unbound signature: AA
  4727.     Error: Compiler bug: ModUtil.shiftStamps.newEnv - bad arg
  4728. Status: fixed in 0.56
  4729. --------------------------------------------------------------------------------
  4730. 200. large integer literals
  4731. Submitter: Peter Buneman
  4732. Date: 12/1/89
  4733. Version: 0.39
  4734. System: Sun 3? 
  4735. Transcript:
  4736.     Standard ML of New Jersey, Version 0.39, 8 September 1989
  4737.     val it = () : unit
  4738.     - val x = 400000000;
  4739.     val x = 400000000 : int
  4740.     - x + x;
  4741.     val it = 800000000 : int
  4742.     - val y = 800000000;
  4743.     val y = ~273741824 : int  (* problem *)
  4744.     - x+x;
  4745.     val it = 800000000 : int
  4746.     - x*x;
  4747.     uncaught exception Overflow
  4748. Status: fixed in 0.52 (on Sun 3 at least)
  4749. --------------------------------------------------------------------------------
  4750. 201. funny tycon aliasing behavior
  4751. Submitter: John Reppy
  4752. Date: 8/18/89
  4753. Version: 0.33
  4754. Transcript
  4755.   Standard ML of New Jersey, Version 0.33, 1 April 1989
  4756.   val it = () : unit
  4757.   - structure A = struct datatype foo = Bar of int end
  4758.   = ;
  4759.   structure A :
  4760.     sig
  4761.       datatype foo
  4762.         con Bar : int -> foo
  4763.     end
  4764.   - structure B : sig datatype foo' = Bar of int end = struct
  4765.   = open A
  4766.   = type foo' = foo
  4767.   = end;
  4768.   structure B :
  4769.     sig
  4770.       datatype foo'
  4771.         con Bar : int -> A.foo
  4772.     end
  4773. Status: fixed in 0.56
  4774. --------------------------------------------------------------------------------
  4775. 202. type error not caught?
  4776. Submitter: Norman Ramsey
  4777. Date: 8/28/89
  4778. Version: ?
  4779. Problem:
  4780.     I believe that the following file should generate a type error, but
  4781.     it doesn't.  In particular, the line val _ = begin_str "replicas"
  4782.     ufanout(c,chans) should force chans to be type 'a chan list when c is
  4783.     type 'a chan.
  4784. Code:
  4785.     datatype 'a chan = CHAN of 'a
  4786.  
  4787.     signature BADGUYS = sig
  4788.     val mkchan : unit -> '1a chan
  4789.     val ufanout : '2a chan * '2a chan list -> 'b
  4790.     val begin_str :  string -> ('a -> 'b) -> 'a -> unit
  4791.     end
  4792.  
  4793.     signature WONKY =  sig
  4794.     val ureplicas : int -> '2a chan -> '6b chan list
  4795.             (* wrong! should be int -> '2a chan -> '2a chan list *)
  4796.       end
  4797.  
  4798.     functor buggy(bad:BADGUYS):WONKY = struct
  4799.  
  4800.     open bad
  4801.  
  4802.     fun ureplicas n c =     (* n unsynchronized copies of channel c *)
  4803.     let fun channels(l,0) = l
  4804.           | channels(l,n) = channels(mkchan()::l,n-1)
  4805.         val chans = channels(nil,n)
  4806.         val _ = begin_str "replicas" ufanout(c,chans)
  4807.     in  chans
  4808.     end
  4809.  
  4810.     end
  4811. Transcript: (0.52)
  4812.   - use "code/bug.202";
  4813.   [opening code/bug.202]
  4814.   code/bug.202:16.36-28.3 Error: value type in structure doesn't match signature
  4815.    spec
  4816.     name: ureplicas
  4817.     spec:   int -> '2a chan -> '6b chan list
  4818.     actual: int -> '1a chan -> '6b chan list
  4819. Status: fixed in 0.56
  4820. --------------------------------------------------------------------------------
  4821. 203. printing of infix specs in signatures
  4822. Submitter: Trevor Jim
  4823. Date: 4/3/89
  4824. Version: 0.32, 0.52
  4825. Problem:
  4826.   infix specs are printed with two precedence numbers
  4827. Transcript:
  4828.     - signature SS = sig infix 5 bar end;
  4829.     signature SS =
  4830.       sig
  4831.     infix 10 10 bar
  4832.       end
  4833. Status: fixed in 0.54
  4834. --------------------------------------------------------------------------------
  4835. 204. constructors printed when not accessible
  4836. Submitter: Dave Berry
  4837. Date: 2/2/89
  4838. Version: 0.52
  4839. Problem:
  4840.   constructors of a datatype in a structure are printed in the structure
  4841.   signature even though they are masked out by a signature constraint.
  4842. Transcript:
  4843.   - signature S1 = sig type d end;
  4844.   signature S1 =
  4845.     sig
  4846.       type d
  4847.     end
  4848.   - structure A : S1 = struct datatype d = A | B of int end;
  4849.   structure A :
  4850.     sig
  4851.       datatype d
  4852.         con A : d
  4853.     con B : int -> d
  4854.     end
  4855. Status: fixed in 0.56
  4856. --------------------------------------------------------------------------------
  4857. 205. performance problem with many opens in a structure
  4858. Submitter: Jawahar Malhotra
  4859. Problem:
  4860. Code:
  4861. structure A = struct (* 30 val declarations *) end
  4862. structure B,C,D... similar
  4863. structure S = struct open A B C D E F G end
  4864. Status: fixed in 0.58
  4865. ------------------------------------------------------------------------------
  4866. 206. unhelpful parser error message (new parser)
  4867. Submitter: Dave
  4868. Date: 3/15/90
  4869. Version: 0.52
  4870. Transcript:
  4871.     - structure A =
  4872.       struct
  4873.         val x = if true then if true then 1 else 2
  4874.       end;
  4875.     std_in:4.1 Error: syntax error found at END
  4876.     -
  4877. Comment: what we need is  %prefer ELSE 0, that is, the ability to give
  4878. a hint for the insertion of two tokens in a row.  Right now, %prefer can
  4879. only hint about single-token insertions.  This fix has to be done
  4880. in mlyacc.
  4881. Status: open
  4882. -------------------------------------------------------------------------------
  4883. 207. uncaught tycStamp exception
  4884. Submitter: Nevin.Heintze@PROOF.ERGO.CS.CMU.EDU
  4885. Date: 4/3/90
  4886. Version: 0.44 (0.53)
  4887. Problem: tycStamp raised during compilation
  4888. Code: (file bug207.sml)
  4889.     signature SS =
  4890.     sig
  4891.       datatype t = B of t | A of t list
  4892.     end
  4893.  
  4894.     functor F(X:SS) =  
  4895.     struct
  4896.       fun f(X.B(v)) = (v :: nil = v :: nil) | f _ = false
  4897.     end
  4898. Transcript:
  4899.     Standard ML of New Jersey, Version 0.44, 4 December 1989
  4900.     val it = () : unit
  4901.     - use "bug.sml";
  4902.     [opening bug.sml]
  4903.     bug.sml, line 11: Error: Compiler bug: tycStamp
  4904.     equal: type = ?.ttt list
  4905.     [closing bug.sml]
  4906.     - 
  4907. Comments:
  4908.     The problem appears to be the typing of the equality test.
  4909.     It is sensitive to the use of lists, both in the datatype
  4910.     definition and the equality test.
  4911. Status: fixed in 0.56
  4912. -------------------------------------------------------------------------------
  4913. 208. bug in optimizer causing bad free variable
  4914. Submitter: Appel & MacQueen
  4915. Date: 4/27/90
  4916. Version: 0.56
  4917. Problem: impossible error in cpsopt phase, on MIPS machine,
  4918.      with default optimization settings
  4919. Code: 
  4920.      functor MipsCoder(val emit : 'a -> unit)  = struct
  4921.        fun needs _ = true
  4922.        fun pass now =
  4923.        let fun gen inst =
  4924.           if now andalso needs() then ()
  4925.           else if now
  4926.          then let fun gen1() = gen(raise Match)
  4927.                in  case inst of
  4928.                  NONE  => gen1()
  4929.                | SOME b =>
  4930.                    let fun bc1f offset = ()
  4931.                    fun bc1t offset = ()
  4932.                    in  if inst=NONE then 
  4933.                     (emit((if b then bc1t else bc1f)
  4934.                              inst); gen1()) 
  4935.                    else ()
  4936.                    end
  4937.                end
  4938.          else ()
  4939.        in  gen
  4940.        end
  4941.        val assemble  = pass true
  4942.      end
  4943.  
  4944. Comment: this can be avoided by setting closurestrategy to 2, which we now
  4945.          do; Trevor may fix this bug eventually.
  4946.  
  4947. Status: avoided in 0.60
  4948. -------------------------------------------------------------------------------
  4949. 209. equality types and functors, again
  4950. Submitter: Appel & MacQueen
  4951. Date: 4/30/90
  4952. Version: 0.56
  4953. Problem:
  4954.     Problem in eqtypes/defineEqTycon/eqty.  failure when attempting to
  4955.     reevaluate equality properties of generative/defined tycons in functor body
  4956.     after functor is applied.
  4957. Code: 
  4958.     signature S1 = sig type t end;
  4959.     structure A = struct type t = int end;
  4960.     functor F(X : S1)  =  
  4961.     struct
  4962.       structure B = struct datatype s1 = K of X.t end
  4963.       type s = B.s1
  4964.     end;
  4965.     structure C = F(A);
  4966. Comments:  we've put in a warning message, and assumed a non-equality type
  4967.     when this happens.  (still causes impossible error in 0.56).
  4968. Status:    "fixed" by following the lead of the Definition and not recalculating
  4969.     equality properties on functor applications.
  4970. --------------------------------------------------------------------------------
  4971. 210. sharing checking with fixed stamps
  4972. Submitter: Appel & MacQueen
  4973. Date: 5/3/90
  4974. Version: 0.56
  4975. Problem:
  4976.     Union exception is not caught when sharing specs try to identify two distinct
  4977.     types or structures (with differing fixed stamps).
  4978. Code:
  4979.     structure S = struct end;
  4980.     structure T = struct end;
  4981.     signature Q = sig sharing S=T end;
  4982. Comments:
  4983.     Easy to fix.  Just add a handler for the Union exception in Sharing.doSharing
  4984.     and produce and appropriate error message.
  4985. Status: fixed in 0.57
  4986. --------------------------------------------------------------------------------
  4987. 211. Union exception processing correct sharing in functor body
  4988. Submitter: MacQueen
  4989. Date: 5/4/90
  4990. Version: 0.56
  4991. Problem:
  4992.     Union exception is raised in doSharing when processing correct sharing
  4993.     specs in a functor body.
  4994. Code: (* bug211.sml *)
  4995.     functor F(type t) =
  4996.     struct
  4997.       structure K =
  4998.       struct 
  4999.     type s = t
  5000.       end
  5001.       structure M : sig structure L : sig type s sharing type s = t end
  5002.             sharing L=K
  5003.             end =
  5004.       struct
  5005.     structure L = K
  5006.       end
  5007.     end;
  5008.  
  5009. Comments:
  5010.     The bug occurs because the type definition shortcut (for "type s = t", s
  5011.     is made a copy (modulo path) of t) is not done when t has a bound stamp,
  5012.     as in the code above.  Here s is a DEFtyc tycon with a different stamp
  5013.     from t.
  5014. Status: fixed in 0.58
  5015. --------------------------------------------------------------------------------
  5016. 212. polymorphic exception declarations
  5017. Submitter:      Dave Berry (for Jo Blishen) (submitted to ml-bugs)
  5018. Date:        5/11/90
  5019. Version:        0.56
  5020. Severity:       major
  5021. Problem:        rejects proper weak polymorphic type for locally declared exception
  5022. Code:
  5023.     fun f (l:'_a) = let exception E of '_a in (raise (E l)) handle E t => t end;
  5024. Comments:
  5025.     Worked in 0.44a.
  5026. Status: fixed in 0.58
  5027.     (suspect related bugs because of the way TyvarSet.union_tyvars is defined.)
  5028. --------------------------------------------------------------------------------
  5029. 213. equality on int*int
  5030. Submitter: Soren Christensen,
  5031.            University of Aarhus, Computer Science Dep.,
  5032.            Denmark
  5033.            schristensen@daimi.dk
  5034. Date:      16 may 90
  5035. Version:   0.56
  5036. System:    Sun4/280 / SunOS 4.0.1
  5037. Severity:  Critical
  5038. Problem:   failure compiling equality on type int*int
  5039. Code:  (* filename: bug213.sml *)
  5040.  
  5041.        (3,3,) = (3,3);
  5042.  
  5043. Transcript:
  5044.     Standard ML of New Jersey, Version 0.56, 13 April 1990
  5045.     Warning: input and output are now uncurried, arithmetic exceptions
  5046.     are re-arranged, div and mod are different; see doc/NEWS
  5047.     val it = () : unit
  5048.     - use "fun";
  5049.     [opening fun]
  5050.     datatype 'a   $$$
  5051.     con $ : 'a -> 'a $$$
  5052.     con $$ : 'a $$$
  5053.     LOOKUP FAILS in close(FIX 2795 2799 2707 2996
  5054.     ) on 2927
  5055.     in environment:
  5056.     2792 2790 2791
  5057.     [closing fun]
  5058.     uncaught exception Match
  5059.     - val x = 5;
  5060.     Illegal instruction
  5061. Comments:
  5062.     [Christensen] It looks like the compiler is messed up after this error. It
  5063.     core-dumps parsing the next declaration.  Version 0.44 has no problem
  5064.     handling this declaration.
  5065.  
  5066.     [dbm] The code "(3,3) = (3,3);" reproduces the bug.  Haven't been able
  5067.     to reproduce the core dump.
  5068. Status: fixed in 0.58.  (bug was in codegen)
  5069. --------------------------------------------------------------------------------
  5070. 214. Compiler bug: EnvAccess.lookPath when printing
  5071. Submitter: Frank Pfenning (Frank.Pfenning@proof.ergo.cs.cmu.edu
  5072. Date: 5/17/90
  5073. Version: 0.56
  5074. Severity: critical
  5075. Problem: Compiler bug: EnvAccess.lookPath occurs when printing a top-level result.
  5076. Code:
  5077.     signature TERM =
  5078.       sig
  5079.     datatype term =  Const of string
  5080.          and varbind = Varbind of string * term
  5081.       end
  5082.  
  5083.     functor Term ( ) : TERM =
  5084.       struct
  5085.     datatype term = Const of string
  5086.          and varbind = Varbind of string * term
  5087.       end
  5088.  
  5089.     signature BUG =
  5090.       sig
  5091.     structure Term : TERM
  5092.     type progentry
  5093.     val bug : progentry list
  5094.       end
  5095.  
  5096.     functor Bug ( structure Term : TERM ) : BUG =
  5097.       struct
  5098.     structure Term = Term
  5099.     open Term
  5100.     datatype progentry =
  5101.       Progentry of string * Term.term * Term.varbind list * Term.term
  5102.     val bug =
  5103.       [Progentry("test",Const "test",
  5104.              [Varbind("v",Const("test"))],Const("test"))]
  5105.       end
  5106.  
  5107.     structure Term : TERM = Term ();
  5108.     structure Bug : BUG = Bug ( structure Term = Term );
  5109.  
  5110.     Bug.bug;
  5111.  
  5112. Status: fixed in 0.58
  5113. --------------------------------------------------------------------------------
  5114. 215. sin gives incorrect values
  5115. Submitter:      Thomas M. Breuel (tmb@ai.mit.edu)
  5116. Date:        5/18/90
  5117. Version:        0.59
  5118. System:         SPARC/SunOS 4.0.3c
  5119. Severity:       major
  5120. Problem: sin function is incorrect
  5121. Transcript:
  5122.     (* SparcStation 1, SunOS 4.0 *)
  5123.     Standard ML of New Jersey, Version 0.56, 13 April 1990
  5124.     Warning: input and output are now uncurried, arithmetic exceptions
  5125.     are re-arranged, div and mod are different; see doc/NEWS
  5126.     val it = () : unit
  5127.     - sin(4.0);
  5128.     val it = ~0.756802495307928 : real
  5129.     - sin(5.0);
  5130.     val it = ~0.958924274663138 : real
  5131.     - sin(6.0);
  5132.     val it = 0.279415498198926 : real
  5133.     - (*     ^^^^^^^^^^^^^^^^^ this should be negative, since it is between pi and 2 pi *)
  5134.  
  5135. Comments:
  5136.         Probably someone transcribed the sin function from the Berkeley
  5137.     math library incorrectly in boot/math.sml.
  5138. Status: fixed in 0.58 (Appel)
  5139. --------------------------------------------------------------------------------
  5140. 216. floating point on SPARC
  5141. Submitter:      tmb@ai.mit.edu
  5142. Date:           Sat May 19 04:52:35 EDT 1990
  5143. Version:        0.56
  5144. System:         Sun SS1, Sun OS 4.0.3
  5145. Severity:       critical
  5146. Problem:        floating point broken in Sparc compiler?!
  5147. Transcript:
  5148.  
  5149. (everything that begins with a TAB comes from an actual transcript)
  5150.   
  5151.     Standard ML of New Jersey, Version 0.56, 13 April 1990
  5152.     Warning: input and output are now uncurried, arithmetic exceptions
  5153.     are re-arranged, div and mod are different; see doc/NEWS
  5154.     val it = () : unit
  5155.     - fun ilist(from:int,to:int,step:int)
  5156.     =     f = if (from<to) then (f from)::ilist(from+step,to,step) f else [];
  5157.     val ilist = fn : int * int * int -> (int -> 'a) -> 'a list
  5158.     - ilist(0,10,1) (fn x => x);
  5159.     val it = [0,1,2,3,4,5,6,7,8,9] : int list
  5160.     - ilist(0,10,1) print;
  5161.     0123456789val it = [(),(),(),(),(),(),(),(),(),()] : (unit) list
  5162.  
  5163. all is as it should be--so far
  5164.  
  5165.     - fun rlist(from:real,to:real,step:real) f =
  5166.     =     if (from<to) then (f from)::rlist(from+step,to,step) f else [];
  5167.     val rlist = fn : real * real * real -> (real -> 'a) -> 'a list
  5168.  
  5169. this is the same definition with different type constraints
  5170.  
  5171.     - rlist(0.0,10.0,1.0) (fn x => x);
  5172.     val it = [] : real list
  5173.  
  5174. ???
  5175.  
  5176.     - rlist(0.0,10.0,1.0) (fn x => x);
  5177.     val it = [0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0] : real list
  5178.  
  5179. same expression, different result???
  5180.  
  5181.     - rlist(0.0,10.0,1.0) (fn x => x);
  5182.     val it = [0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0] : real list
  5183.  
  5184. now it seems to work...
  5185.  
  5186.     - rlist(0.0,10.0,1.0) print;
  5187.     0.0val it = [()] : (unit) list
  5188.  
  5189. but it still doesn't work with "print"
  5190.  
  5191.     - rlist(0.0,10.0,1.0) (fn x => x);
  5192.     val it = [0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0] : real list
  5193.     - 
  5194.  
  5195. Comments:
  5196.  
  5197. These problems don't occur on the m68 version of SML. In fact,
  5198. the problem with "sin" that I reported previously also doesn't
  5199. occur with the m68 version.
  5200.  
  5201. Maybe this is an installation problem, but if it is, then there is
  5202. probably something wrong with the makeml script. The Sparc version
  5203. was generated with "makeml -sun4 -sunos" if I remember correctly.
  5204.  
  5205. Here is the transcript from a Sun-3:
  5206.  
  5207.     Standard ML of New Jersey, Version 0.56, 13 April 1990
  5208.     Warning: input and output are now uncurried, arithmetic exceptions
  5209.     are re-arranged, div and mod are different; see doc/NEWS
  5210.     val it = () : unit
  5211.     - [opening /tmp_mnt/home/vi/tmb/cad/bad.sml]
  5212.     val identity = fn : 'a -> 'a
  5213.     val ilist = fn : int * int * int -> (int -> 'a) -> 'a list
  5214.     val rlist = fn : real * real * real -> (real -> 'a) -> 'a list
  5215.     [closing /tmp_mnt/home/vi/tmb/cad/bad.sml]
  5216.     val it = () : unit
  5217.  
  5218. these are the same definitions as above
  5219.  
  5220.     - ilist(0,10,1) (fn x => x);
  5221.     val it = [0,1,2,3,4,5,6,7,8,9] : int list
  5222.     - ilist(0,10,1) print;
  5223.     0123456789val it = [(),(),(),(),(),(),(),(),(),()] : (unit) list
  5224.     - rlist(0.0,10.0,1.0) (fn x => x);
  5225.     val it = [0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0] : real list
  5226.     - rlist(0.0,10.0,1.0) print;
  5227.     0.01.02.03.04.05.06.07.08.09.0val it = [(),(),(),(),(),(),(),(),(),()] : (unit) list
  5228.     - sin 6.0;
  5229.     val it = ~0.279415498198926 : real
  5230.     - sin 5.0;
  5231.     val it = ~0.958924274663138 : real
  5232.     - 
  5233.  
  5234. Status: fixed in 0.58 (Reppy)
  5235. --------------------------------------------------------------------------------
  5236. 217. simultaneous opens
  5237. Submitter: Larry Paulson (lcp@lfcs.ed.ac.uk)
  5238. Date: 5/25/90
  5239. Version: 0.56
  5240. Severity: major
  5241. Problem: opening several structures simultaneously can result in Runbind
  5242. Code: code/bug217.sml
  5243.     structure A = struct val x = 3  end;
  5244.     structure B = struct structure A = A; end;
  5245.     open A B;
  5246.     x;
  5247. Comments:
  5248.    This works if "open A B;" is replaced with "open A; open B;"
  5249. Status: fixed in 0.59
  5250. --------------------------------------------------------------------------------
  5251. 218. compiler bug after unbound variable
  5252. Submitter: John Reppy (jhr@cs.cornell.edu)
  5253. Date: 5/26/90
  5254. Version: 0.57
  5255. Severity: major
  5256. Problem: Compiler bug: generalizeTy -- bad arg occurs after top level unbound var
  5257. Transcript:
  5258.   - x;
  5259.   std_in:2.1 Error: unbound variable x
  5260.   Error: Compiler bug: generalizeTy -- bad arg
  5261. Status: fixed in 0.59
  5262. --------------------------------------------------------------------------------
  5263. 219. parsing layered patterns
  5264. Submitter: Andrew Appel
  5265. Date: 5/90
  5266. Version: 0.56 and later
  5267. Severity: minor
  5268. Problem: parsing of layered pattern is too liberal.  An atomic pattern is
  5269.   accepted where a variable is required by the Definition syntax.
  5270. Code:
  5271.   let val (x) as (y :: z) = [1,2] in x end
  5272. Comments:
  5273.   Seems to require nontrivial change to the mlyacc grammar
  5274. Status: open
  5275. --------------------------------------------------------------------------------
  5276. 220. Match exception after error
  5277. Submitter: John Reppy
  5278. Date: 6/1/90
  5279. Version: 0.58
  5280. System: Sun 4
  5281. Severity: minor
  5282. Problem: uncaught exception Match after signature matching error
  5283. Code:
  5284.   signature S = sig
  5285.     type foo
  5286.     val f : int -> foo
  5287.   end
  5288.   
  5289.   structure Foo : S = struct
  5290.     datatype foo_t = Foo of int
  5291.     val f = Foo
  5292.   end
  5293.  
  5294. Transcript:
  5295.   xxx.sml:6.21-9.3 Error: unmatched type spec: foo
  5296.   xxx.sml:6.21-9.3 Error: value type in structure doesn't match signature spec
  5297.     name: f
  5298.     spec:   int -> [closing xxx.sml]
  5299.  
  5300.   uncaught exception Match
  5301.   - 
  5302. Comment:
  5303. Now produces
  5304.     std_in:10.21-13.3 Error: unmatched type spec: foo
  5305.     std_in:10.21-13.3 Error: value type in structure doesn't match signature spec
  5306.       name: f
  5307.       spec:   int -> NULLtyc
  5308.       actual: int -> foo_t
  5309. The NULLtyc is undesirable.
  5310.  
  5311. Status: partially fixed (before 0.65)
  5312. --------------------------------------------------------------------------------
  5313. 221. profiling broken
  5314. Submitter: Benjamin Pierce (Benjamin.Pierce%proof.ergo.cs.cmu.edu
  5315. Date: 5/22/1990
  5316. System: 0.56 (and later)
  5317. Problem:
  5318.   Profiling provides call counts bug not timings.  For separately compiled
  5319.   modules, profiling provides neither call counts nor timings.
  5320. Transcript:
  5321.  (1) for separately compiled code
  5322.  %time  cumsecs     #call   ms/call  name
  5323.             .00         0            (toplevel)
  5324.             .00         0            (gc)
  5325.             .00         0            (unprofiled)
  5326.  
  5327.  
  5328.  (2) for "used" code
  5329.  %time  cumsecs     #call   ms/call  name
  5330.             .00      2398     .0000  anon.AType.==.anon
  5331.             .00      2398     .0000  anon.AType.==
  5332.             .00      2051     .0000  anon.Id.==.anon
  5333.             .00      2051     .0000  anon.Id.==
  5334.             .00      1890     .0000  anon.AType.apply_rule.anon
  5335.         [etc...]
  5336. Fix:
  5337. Some of the problems may be caused by handleprof() in runtime/signal.c
  5338. being braindamaged.  I changed it to be:
  5339.  
  5340.   SIGH_RET_TYPE handleprof ()
  5341.   {
  5342.     extern ML_val_t current0[];
  5343.     ML_val_t cur_barray = current0[1];
  5344.     cur_barray[1] = (unsigned int)INT_incr(cur_barray[1],1);
  5345.   }
  5346.  
  5347. and it seemed to work for simple examples.  However, I'm not too sure
  5348. that the times mean anything for larger examples.  Perhaps there's some
  5349. bad interaction with GC?
  5350. Status: fixed in 0.70
  5351. --------------------------------------------------------------------------------
  5352. 222. equality on ref types
  5353. Submitter:      Larry Paulson <lcp@lfcs.edinburgh.ac.uk>
  5354. Date:        11/6/90
  5355. Version:        0.56, 0.59
  5356. Severity:       major
  5357. Problem:
  5358.     ref type not being recognized as unconditionally an equality type
  5359. Transcript:
  5360.     - fun silly x = (ref x = ref x);
  5361.     val silly = fn : ''1a -> bool
  5362.     - silly not;
  5363.     std_in:4.1-4.9 Error: operator and operand don't agree (equality type required)
  5364.       operator domain: ''0S
  5365.       operand:         bool -> bool
  5366.       in expression:
  5367.     silly not
  5368.  
  5369.     And anyway the type checker behaves inconsistently by admitting the
  5370.     following:
  5371.  
  5372.     - ref not = ref not;
  5373.     val it = false : bool
  5374. Status: fixed (before 0.65)
  5375. --------------------------------------------------------------------------------
  5376. 223. nontty standard input and uncaught exceptions
  5377. Submitter:    KINOSHITA Yoshiki    yoshiki@etl.go.jp
  5378. Date:        4, June 1990
  5379. Version:    SML of NJ 0.56
  5380. System:        Sparc Station 330 (SUN4), SUN-OS 4.0.3 (generic version)
  5381. Severity:    major
  5382. Problem:    If the standard input is a pipe, the system ends
  5383.         abnormally after it sends an error message.
  5384. Code:        None.  The problem concerns with the interface to UNIX.
  5385. Transcript:
  5386.     % cat - | sml  
  5387.     Standard ML of New Jersey, Version 0.56, 13 April 1990 
  5388.     Warning: input and output are now uncurried, arithmetic exceptions 
  5389.     are re-arranged, div and mod are different; see doc/NEWS 
  5390.     val it = () : unit 
  5391.     - foo; 
  5392.     std_in:2.1-2.3 Error: unbound variable foo 
  5393.     uncaught exception Stop 
  5394.     ^Z 
  5395.     Stopped  
  5396.     % jobs 
  5397.     [1]  + Stopped              cat - | 
  5398.            Done                 sml 
  5399.     %
  5400.  
  5401. Comments:    This problem makes it impossible to use the system with
  5402.         its input sent through a UNIX filter.
  5403.   from jhr:
  5404.     You might call this a feature.  It appears that the person who wrote
  5405.     the top-level loop code (interact.sml), decided that exceptions
  5406.     should only be caught at the top-level loop when std_in is a tty
  5407.     (look at lines 292-309 in interact.sml).  The following work-around
  5408.     avoids the problem
  5409.  
  5410.       <jhr@rocky:76> cat - | sml
  5411.       Standard ML of New Jersey, Version 0.59, 4 June 1990
  5412.       Warning: input and output are now uncurried, arithmetic exceptions
  5413.       are re-arranged, div and mod are different; see doc/NEWS
  5414.       val it = () : unit
  5415.       - set_term_in(std_in, true);
  5416.       val it = () : unit
  5417.       - foo;
  5418.       std_in:3.1-3.3 Error: unbound variable foo
  5419.       - 1+2;
  5420.       val it = 3 : int
  5421.       - 
  5422.  
  5423.     But, maybe the code should change.  It isn't clear to me what the correct
  5424.     semantics are in this case.  This problem came up here at Cornell when
  5425.     Bill Aitken was using "rsh" to run sml on a remote machine.
  5426. Status: fixed in 0.65
  5427. --------------------------------------------------------------------------------
  5428. 224. weakness 0 type variables in let declaration
  5429. Submitter:      Larry Paulson
  5430. Date:        6/4/90
  5431. Version:        0.56, 0.59
  5432. Severity:       major
  5433. Problem:
  5434.     A weakness 0 type variable should be admitted, but not generalized, in local
  5435.     declarations.
  5436. Transcript:     <transcript of session illustrating problem>
  5437.     - let val f = ref(fn x => x) in f := not; !f true end;
  5438.     std_in:1.9-1.26 Error: nongeneric weak type variable
  5439.       f : ('0Y -> '0Y) ref
  5440.     std_in:1.9-1.26 Error: nongeneric weak type variable
  5441.       f : ('0Y -> '0Y) ref
  5442. Comments:
  5443.     This worked in 0.44.
  5444. Status: fixed (before 0.65)
  5445. --------------------------------------------------------------------------------
  5446. 225. import broken in 0.59
  5447. Submitter:   Lars Bo Nielsen <lbn@iesd.auc.dk>
  5448. Date:        Jun 5, 1990
  5449. Version:     Version 0.59
  5450. System:      Sparc/sunos
  5451. Severity:    critical
  5452. Problem:     import broken. A simple 'import "file"' doesn't work, if
  5453.              only 'file.sml' is present. If 'file.bin' is present it
  5454.              works.
  5455.          I DIDN'T have this problem with version 0.56.
  5456. Transcript:  
  5457.  
  5458.    The following example shows the problem.
  5459.  
  5460.    SHELL% ll
  5461.    total 68
  5462.       2 calc.dsl             11 calc.grm.sml         31 calc.parser.sml
  5463.       3 calc.grm              1 calc.instr            2 calc.sml
  5464.       4 calc.grm.desc         2 calc.lex
  5465.       1 calc.grm.sig         11 calc.lex.sml
  5466.    SHELL% sml
  5467.    Standard ML of New Jersey, Version 0.59, 4 June 1990
  5468.    Warning: input and output are now uncurried, arithmetic exceptions
  5469.    are re-arranged, div and mod are different; see doc/NEWS
  5470.    val it = () : unit
  5471.    - import "calc.parser";
  5472.  
  5473.    uncaught exception SystemCall
  5474.    - ^Z
  5475.    Stopped
  5476.    SHELL% touch calc.parser.bin
  5477.    SHELL% fg
  5478.    sml
  5479.    - import "calc.parser";
  5480.    [reading calc.parser.bin... ]
  5481.    [calc.parser.bin is the wrong format; recompiling
  5482.    [closing calc.parser.bin]
  5483.    [reading calc.parser.sml]
  5484.  
  5485.    [Major collection... 69% used (1475096/2123360), 1700 msec]
  5486.  
  5487.    [Increasing heap to 4451k]
  5488.  
  5489.    ..... etc .....
  5490.  
  5491. Status: fixed in 0.60 (jhr)
  5492. --------------------------------------------------------------------------------
  5493. 226. uncaught exception Match while printing type  (same as 220)
  5494. Submitter:      John Reppy
  5495. Date:        6/1/90
  5496. Version:        0.56
  5497. Severity:       major
  5498. Problem:
  5499.    Uncaught Match exception occurs when printing out the spec type in an error message.
  5500. Code:
  5501.  
  5502.   signature S = sig
  5503.     type foo
  5504.     val f : int -> foo
  5505.   end
  5506.   
  5507.   structure Foo : S = struct
  5508.     datatype foo_t = Foo of int
  5509.     val f = Foo
  5510.   end
  5511.  
  5512. Transcript:
  5513.   xxx.sml:6.21-9.3 Error: unmatched type spec: foo
  5514.   xxx.sml:6.21-9.3 Error: value type in structure doesn't match signature spec
  5515.     name: f
  5516.     spec:   int -> [closing xxx.sml]
  5517.  
  5518.   uncaught exception Match
  5519.   - 
  5520.  
  5521. Status: partially fixed (before 0.65)
  5522. --------------------------------------------------------------------------------
  5523. 227. equality property of datatypes
  5524. Submitter: Brian Boutel (brian@comp.vuw.ac.nz)
  5525. Date: May 25 1990
  5526. Version: 0.56
  5527. System: Sun3/sunos and H-P workstation (More/bsd)
  5528. Severity: major
  5529. Problem: Equality test for recursive types may fail in various ways
  5530.  (similar to bug 45, reported fixed)
  5531.  
  5532. Description:
  5533. Given
  5534. datatype 'a d1 = c11 | c12 of ('a * 'a d1);
  5535. datatype 'a d2 = c21 | c22 of ('a d2 * 'a );
  5536. datatype    d3 = c31 | c32 of ( d3 * int);
  5537.  
  5538. a) c11 = c11 works correctly
  5539. b) c12(1,c11) = c12(1,c11) gets uncaught exception Match (* ok in 0.59 *)
  5540. c) c21 = c21 loops forever  (* in 0.59 as well *)
  5541. d) c22(c21,1) = c22(c21,1) gets uncaught exception Match (* ok in 0.59 *)
  5542. e) c31 = c31 works correctly
  5543. f) c32(c31,1) = c32(c31,1) gets uncaught exception Match (* ok in 0.59 *)
  5544.  
  5545. Transcript: (with System.Control.debugging := true)
  5546. b)
  5547. -  c12(1,c11) = c12(1,c11);
  5548. parse
  5549. semantics
  5550.  
  5551. BEFORE:
  5552. val it = = (c12 (1,c11),c12 (1,c11))
  5553.  
  5554. AFTER:
  5555. val it = = (c12 (1,c11),c12 (1,c11))
  5556.  
  5557. test: int d1
  5558. test: int d1
  5559. find: int d1
  5560. find-notfound
  5561. enter: int d1
  5562. test: int * int d1
  5563. find: int * int d1
  5564. find-notfound
  5565. enter: int * int d1
  5566. test: int
  5567. test: int
  5568. test: int d1
  5569. find: int d1
  5570. translate
  5571. reorder
  5572. convert
  5573. cpsopt
  5574. closure
  5575. LOOKUP FAILS in close(FIX 4146 4150
  5576. ) on 4161
  5577. in environment:
  5578. 4143 4141 4142
  5579. globalfix
  5580. spill
  5581. codegen
  5582. uncaught exception Match
  5583. -
  5584.  
  5585. c)
  5586. - c21 = c21;
  5587. parse
  5588. semantics
  5589.  
  5590. BEFORE:
  5591. val it = = (c21,c21)
  5592.  
  5593.  
  5594. AFTER:
  5595. val it = = (c21,c21)
  5596.  
  5597. test: ''S d2
  5598. test: ''S d2
  5599. find: ''S d2
  5600. find-notfound
  5601. enter: ''S d2
  5602. test: ''S d2 * ''S
  5603. find: ''S d2 * ''S
  5604. find-notfound
  5605. enter: ''S d2 * ''S
  5606. test: ''S d2
  5607. find: ''S d2
  5608. find-notfound
  5609. enter: ''S d2
  5610. test: ''S d2 * ''S
  5611. find: ''S d2 * ''S
  5612. find-notfound
  5613. enter: ''S d2 * ''S
  5614. test: ''S d2
  5615. find: ''S d2
  5616. find-notfound
  5617. .....
  5618.  
  5619. Status: fixed in 0.60
  5620. --------------------------------------------------------------------------------
  5621. 228. string to real conversion
  5622. Submitter:      jubu@tub.UUCP or jubu@tub.BITNET (Juergen Buntrock TUB)
  5623. Date:           Fri Apr 27 14:12:10 MET DST 1990
  5624. Version:        0.44
  5625. System:         Sun4, SunOS Release 4.0.3c
  5626. Severity:       critical
  5627. Code:           and Transcript:
  5628.  
  5629. Script started on Fri Apr 27 13:49:54 1990
  5630. jubu@curry mlj/handel 1) cat bug.sml
  5631. exception bad_number;
  5632.  
  5633. fun string2real (s : string) = let
  5634.     val (fac,li) = case explode s of
  5635.         "-" :: li => (~1.0,li) |
  5636.         "+" :: li => (1.0,li) |
  5637.         li => (1.0,li)
  5638.     val (res,_) = (revfold (fn (c,(a,fac1)) => let
  5639.         val n = ord c - ord "0"
  5640.         in
  5641.         output std_out ""; (* comiler bug ! *)
  5642.         if fac1 > 0.0
  5643.         then
  5644.             if n < 0 orelse n > 9
  5645.             then raise bad_number
  5646.             else (a + fac1 * (real n),fac1/10.0)
  5647.         else if c = "."
  5648.         then (a,1.0/10.0)
  5649.         else
  5650.             if n < 0 orelse n > 9
  5651.             then raise bad_number
  5652.             else (10.0 * a + (real n),0.0)
  5653.         end) li (0.0,0.0))
  5654.     in
  5655.     res * fac
  5656.     end
  5657.  
  5658. fun string2real_bug (s : string) = let
  5659.     val (fac,li) = case explode s of
  5660.         "-" :: li => (~1.0,li) |
  5661.         "+" :: li => (1.0,li) |
  5662.         li => (1.0,li)
  5663.     val (res,_) = (revfold (fn (c,(a,fac1)) => let
  5664.         val n = ord c - ord "0"
  5665.         in
  5666.         if fac1 > 0.0
  5667.         then
  5668.             if n < 0 orelse n > 9
  5669.             then raise bad_number
  5670.             else (a + fac1 * (real n),fac1/10.0)
  5671.         else if c = "."
  5672.         then (a,1.0/10.0)
  5673.         else
  5674.             if n < 0 orelse n > 9
  5675.             then raise bad_number
  5676.             else (10.0 * a + (real n),0.0)
  5677.         end) li (0.0,0.0))
  5678.     in
  5679.     res * fac
  5680.     end
  5681.  
  5682.  
  5683. jubu@curry mlj/handel 2) sml
  5684. Standard ML of New Jersey, Version 0.44, 4 December 1989
  5685. val it = () : unit
  5686. - use"bug.sml";
  5687. [opening bug.sml]
  5688. exception bad_number
  5689. val string2real = fn : string -> real
  5690. val string2real_bug = fn : string -> real
  5691. [closing bug.sml]
  5692. val it = () : unit
  5693. - string2real "123.456";
  5694. val it = 123.456 : real
  5695. - string2real_bug "123.456";
  5696. val it = 12346.0 : real
  5697. - open System.Control.CG;
  5698. structure M68 :
  5699.   sig
  5700.     val trapv : bool ref
  5701.   end
  5702. val reducemore = ref 15 : int ref
  5703. val printit = ref false : bool ref
  5704. val knowngen = ref 12 : int ref
  5705. val etasplit = ref true : bool ref
  5706. val comment = ref false : bool ref
  5707. val knowncl = ref 0 : int ref
  5708. val scheduling = ref true : bool ref
  5709. val printsize = ref false : bool ref
  5710. val reduce = ref true : bool ref
  5711. val closureprint = ref false : bool ref
  5712. val stdgen = ref 64 : int ref
  5713. val alphac = ref true : bool ref
  5714. val profile = ref false : bool ref
  5715. val hoist = ref true : bool ref
  5716. val foldconst = ref true : bool ref
  5717. val tailrecur = ref true : bool ref
  5718. val path = ref false : bool ref
  5719. val rounds = ref 1 : int ref
  5720. val closureStrategy = ref 1 : int ref
  5721. val recordopt = ref true : bool ref
  5722. val bodysize = ref 0 : int ref
  5723. val tail = ref true : bool ref
  5724. -
  5725. script done on Fri Apr 27 13:55:57 1990
  5726.  
  5727. Comments:
  5728.    the Sun3 Compiler is correct
  5729. Status: fixed in 0.56
  5730. --------------------------------------------------------------------------------
  5731. 229. uncaught Match after signature spec error
  5732. Submitter: Peter Buneman
  5733. Date: 4/21/89
  5734. Version: 0.59
  5735. Severity: major
  5736. Problem:
  5737.    Following code produces uncaught Match exception
  5738. Code:
  5739.     signature SS = sig type t1 val t2:t1 end;
  5740.  
  5741.     structure ss:SS =
  5742.       struct local
  5743.            datatype t = T of int
  5744.          in val t2 = T 3
  5745.          end
  5746.       end;
  5747. Comment: 
  5748. Output in 0.65 is
  5749.     std_in:8.1-12.3 Error: unmatched type spec: t1
  5750.     std_in:8.1-12.3 Error: value type in structure doesn't match signature spec
  5751.       name: t2
  5752.       spec:   NULLtyc
  5753.       actual: ?.ss.t
  5754. NULLtyc for spec is undesirable (similar to 220,226 problem).
  5755.  
  5756. Status: partially fixed (before 0.65)
  5757. --------------------------------------------------------------------------------
  5758. 230. printing reals on mips
  5759. Submitter:      David MacQueen, Andrew Tolmach
  5760. Date:        6/12/90
  5761. Version:        0.59
  5762. System:         MIPS, RISCos
  5763. Severity:       critical
  5764. Problem:
  5765.     Uncaught exception Overflow when printing real numbers at top level.  Infinite
  5766.     loop in other cases (e.g. code/bug230.sml).
  5767. Transcript:
  5768.     - 1.0;
  5769.     val it =
  5770.     uncaught exception Overflow
  5771.     -
  5772. Comment: works ok on Sun3 and Sun4.
  5773.     works ok on DECsystem (with MIPS chip) / Ultrix
  5774. Status: fixed in 0.64
  5775. --------------------------------------------------------------------------------
  5776. 231. equality property of DEFtyc
  5777. Submitter:      Nick Rothwell
  5778. Date:        6/21/90
  5779. Version:        0.56?
  5780. Severity:       major
  5781. Problem:
  5782.   A type abbreviation for an abstract type admits equality.
  5783. Code:
  5784.     abstype A = A
  5785.     with
  5786.       type B = A
  5787.     end;
  5788.  
  5789.     fn (x: B) => (x=x);
  5790.  
  5791. Comments:
  5792.    The type name associated with A (and therefore with B) should be
  5793.    stripped of its equality attribute outside the "abstype".
  5794. Status: fixed in 0.69
  5795. --------------------------------------------------------------------------------
  5796. 232. user bound type variable in exception declaration 
  5797. Submitter:      Jo Blishen, Nick Rothwell
  5798. Date:        6/20/90
  5799. Version:    0.59
  5800. Severity:       minor
  5801. Problem:
  5802.   User-bound tyvar is not generalized at val binding containing it.
  5803. Transcript:
  5804.   - fun f l = let exception E of '_a in (raise (E l)) handle E t => t end;
  5805.   std_in:2.30-2.32 Error: unbound tyvars in exception declaration
  5806. Comments:
  5807.   According to the Definition '_a should be considered bound at the outermost
  5808.   val (fun f l ...) where it is the type of the lambda-bound variable l.
  5809. Status: fixed in 0.65
  5810. --------------------------------------------------------------------------------
  5811. 233. opening locally declared structure causes Runbind
  5812. Submitter:      Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
  5813. Date:        Wed Jun 20 17:21:17 BST 1990
  5814. Version:        0.56 (applies to 0.59 as well I believe)
  5815. System:         Sun3, SunOS 4.1
  5816. Severity:       You decide....
  5817. Problem:
  5818.   You cannot declare a local structure and open it.
  5819. Transcript:
  5820.     Standard ML of New Jersey, Version 0.56, 13 April 1990
  5821.     val it = () : unit
  5822.     - local
  5823.     =   structure Bug =
  5824.     =     struct
  5825.     =       val message = "Try to evaluate me !"
  5826.     =     end
  5827.     = in
  5828.     =   open Bug
  5829.     = end ;
  5830.     open Bug
  5831.     - message;
  5832.     uncaught exception Runbind
  5833.     - 
  5834. Status: fixed in 0.60
  5835. --------------------------------------------------------------------------------
  5836. 234. Compiler Bug: abstractBody.abstractType 1
  5837. Submitter: deutsch@poly.polytechnique.fr.
  5838.    Alain Deutsch,
  5839.    Laboratoire d'Informatique de l'Ecole Polytechnique (LIX)
  5840.    91128 Palaiseau Cedex
  5841.    France.
  5842. Date: Tue Jun 19 11:04:05 MET DST 1990
  5843. Version: Standard ML of New Jersey, Version 0.56, 13 April 1990
  5844. System: Sun 3/60, SunOS Release 4.0_Export
  5845. Severity: major (?)
  5846. Problem: Compiler Bug: abstractBody.abstractType 1
  5847. Code: Too long, ommited.
  5848. Transcript:
  5849.    - use "/home/icsla/deutsch/ESTFM/basic_ev.sml";
  5850.    [opening /home/icsla/deutsch/ESTFM/basic_ev.sml]
  5851.    [reading Powerset.bin... done]
  5852.    signature FunctionLattice
  5853.    signature ProductLattice
  5854.    signature OrderedSet
  5855.    signature Lattice
  5856.    signature Product
  5857.    signature PartialFunction
  5858.    signature TotalFunction
  5859.    functor Powerset
  5860.    [reading HashTable.bin... done]
  5861.    signature arrayext
  5862.    functor HashTable
  5863.    functor arrayext
  5864.    [reading lattice.sig.bin... done]
  5865.    signature FunctionLattice
  5866.    signature ProductLattice
  5867.    signature OrderedSet
  5868.    signature Lattice
  5869.    signature Product
  5870.    signature PartialFunction
  5871.    signature TotalFunction
  5872.    [reading Syntax.sig.bin... done]
  5873.    signature Syntax
  5874.    [reading StrgHash.sig.bin... done]
  5875.    signature StrgHash
  5876.    [reading Error.sig.bin... done]
  5877.    signature Error
  5878.    [reading ListUtilities.sig.bin... 
  5879.    [Major collection... 66% used (2325300/3480644), 2680 msec]
  5880.  
  5881.    [Increasing heap to 7023k]
  5882.    done]
  5883.    signature ListUtilities
  5884.    [reading Io.sig.bin... done]
  5885.    signature Io
  5886.    [closing /home/icsla/deutsch/ESTFM/basic_ev.sml]
  5887.    /home/icsla/deutsch/ESTFM/basic_ev.sml:20.3 Compiler Bug: abstractBody.abstractType 1
  5888.    - 
  5889.  
  5890. Comments: the bug is not systematic, and hard to reproduce, this is why the
  5891. source code has been ommited, as I have not been able to isolate the faulty part
  5892. of the source.
  5893.  
  5894. Status: fixed in 0.65 (same as 261)
  5895. --------------------------------------------------------------------------------
  5896. 235. repeated type variables in typdesc and datdesc
  5897. Submitter:      Don Sannella <dts@informatik.uni-Bremen.de>
  5898. Date:        6/13/90
  5899. Version:        0.44?
  5900. Severity:       major
  5901. Problem:
  5902.     The Definition of SML seems to allow repeated type variables in a typdesc and
  5903.     datdesc, making the following signatures legal:
  5904.  
  5905.     signature SIG1 =
  5906.      sig
  5907.         eqtype ('a,'a) t1
  5908.         type ('a,'a) t2
  5909.      end
  5910.  
  5911.     signature SIG2 =
  5912.      sig
  5913.         datatype ('a,'a) t3 = foo of 'a
  5914.      end
  5915.  
  5916.     Section 2.9 forbids repeated variables in a typbind and datbind, but I don't
  5917.     see anything forbidding it in a typdesc or datdesc.  I assume below that the
  5918.     omission of a syntactic restriction here was intentional.
  5919.  
  5920.     Repeated type variables in a typdesc seem unproblematic if strange, since the
  5921.     semantics only looks at the number of variables.  SML-NJ accepts SIG1 above,
  5922.     and treats it the same as a signature without repeated type variables, which is
  5923.     correct.
  5924.  
  5925.     Repeated type variables in a datdesc are more of a problem, since the
  5926.     constructors refer to them.  According to the Definition, foo in SIG2 above
  5927.     gets type 'a -> ('a,'a) t3.  Both of the following structures then match SIG2:
  5928.  
  5929.     structure A =
  5930.      struct
  5931.         datatype ('a,'b) t3 = foo of 'a
  5932.      end
  5933.  
  5934.     structure B =
  5935.      struct
  5936.         datatype ('a,'b) t3 = foo of 'b
  5937.      end
  5938.  
  5939.     SML-NJ (version 0.44a) says foo : 'a -> ('a,'b) t3, which is wrong.  The result
  5940.     of this is that A matches SIG2 but B does not.  I don't know about Poly-SML,
  5941.     since I don't have it here.
  5942. Status: fixed in 0.65
  5943. --------------------------------------------------------------------------------
  5944. 236. Mach problems in 0.59
  5945. Submitter:      David Tarditi
  5946. Date:        6/18/90
  5947. Version:        0.59
  5948. System:         Mach
  5949. Severity:       critical
  5950. Comments:
  5951.     I have installed version 0.59 on Vaxes, Suns, and Pmaxes running Mach.
  5952.  
  5953.     There were two problems:
  5954.  
  5955.     VAX.prim.s contained a reference to the variable maskSignals.
  5956.     The name should be _maskSignals instead.
  5957.  
  5958.     The file export.c should also include the file ml_os.h, which
  5959.     contains some definitions needed for Decstations running Mach.
  5960. Status: fixed in 0.60
  5961.  
  5962. --------------------------------------------------------------------------------
  5963. 237. Can't parse most-negative integer constant
  5964. Submitter:      David Berry
  5965. Date:        6/5/90
  5966. Version:        0.56
  5967. System:         All
  5968. Severity:       mild
  5969. Comments:
  5970.  
  5971. - ~1073741823;
  5972. exception Overflow
  5973.  
  5974. - ~1073741822;
  5975. val it = ~1073741822: int
  5976.  
  5977. - it - 1;
  5978. val it = ~1073741823: int
  5979.  
  5980. Status: fixed in 0.60
  5981. --------------------------------------------------------------------------------
  5982. 238. div is unreliable at extremes
  5983. Submitter:      Andrew Appel
  5984. Date:        7/5/90
  5985. Version:        0.56
  5986. System:         All
  5987. Severity:       mild
  5988. Comments:
  5989.  
  5990. - val a = ~1073741822 - 2;
  5991.   val a = ~1073741824: int
  5992. - a div 2;
  5993.  
  5994. uncaught exception Overflow;
  5995.  
  5996. Status: fixed in 0.60
  5997. --------------------------------------------------------------------------------
  5998. 239. INCONSISTENT exception raised in sharing analysis
  5999. Submitter:      Nick
  6000. Date:        13 July
  6001. Version:        0.56, 0.59
  6002. System:         <irrelevant>
  6003. Severity:       Serious
  6004. Problem:        Internal exception raised in the typechecker during sharing
  6005.         analysis
  6006. Code:
  6007.  
  6008.     signature A =
  6009.       sig
  6010.         type A
  6011.         datatype Foo = FOO of A
  6012.       end;
  6013.  
  6014.     signature B = sig  type B  end;
  6015.  
  6016.     signature C = sig  datatype C = C of int -> int  end;
  6017.  
  6018.     functor XYZZY(structure A: A
  6019.               structure B: B sharing type A.A = B.B
  6020.               structure C: C sharing type C.C = B.B
  6021.              ) =
  6022.       struct
  6023.       end;
  6024.  
  6025. Transcript:
  6026.  
  6027.     signature A =
  6028.       sig
  6029.         type A
  6030.         datatype Foo
  6031.           con FOO : A -> Foo
  6032.       end
  6033.     signature B =
  6034.       sig
  6035.         type B
  6036.       end
  6037.     signature C =
  6038.       sig
  6039.         datatype C
  6040.           con C : (int -> int) -> C
  6041.       end
  6042.     [closing Kit/foo.sml]
  6043.     uncaught exception INCONSISTENT
  6044. Status: fixed in 0.61 (dbm)
  6045. --------------------------------------------------------------------------------
  6046. 240. concrete printing of abstype value
  6047. Submitter:      Allen Leung. allen@sbcs.sunysb.edu
  6048. Date:           July 12th, 1990
  6049. Version:        v59    4 June, 1990
  6050. System:         SUN 3 on bsd
  6051. Severity:       minor
  6052. Problem:        Toplevel printing of abstype is transparent.
  6053. Code:           - abstype Foo = Foo of int
  6054.                 = with fun foo i = Foo i end
  6055.                 = val bar = foo 0;
  6056.                 > type Foo
  6057.                 > val foo = fn : int -> Foo
  6058.                 > val bar = Foo 0 : Foo    (* instead of - : Foo *)
  6059.                 -
  6060. Transcript:     
  6061. Comments:       Is this a new feature of v59+?
  6062.                 It does help debugging. 
  6063. Status: fixed in 0.64
  6064. --------------------------------------------------------------------------------
  6065. 241. sharing constraint error ignored
  6066. Submitter:      David Turner
  6067. Date:           12 July '90
  6068. Version:        0.59
  6069. System:         Sun4
  6070. Severity:       Slightly irritating
  6071. Problem:        Ignores error in sharing constraint even though it
  6072.         obviously detects it.
  6073.  
  6074. Input:
  6075.         - signature S = sig  type t  end;
  6076.  
  6077.     - functor F
  6078.         (structure A : S
  6079.          structure B : S
  6080.             sharing type B.t = A.s) = struct end;
  6081.  
  6082. Output:
  6083.     Error: unbound type in structure: s
  6084.     functor F : <sig>
  6085. Comment:
  6086.   Nonstandard function used in doSharing to report the bug.
  6087.   In 0.65 error message is:
  6088.      std_in:9.6-11.23 Error: unbound type in structure: s
  6089.   This doesn't provide as much useful information as it should.  Error
  6090.   message should read something like "unbound type A.s in sharing spec".
  6091.  
  6092. Status: fixed in 0.65
  6093. -------------------------------------------------------------------------------
  6094. 242. incorrect forward referencing allowed
  6095. Submitter:      Nick
  6096. Date:        12 July '90
  6097. Version:        0.56, 0.59
  6098. System:         Irrelevant
  6099. Severity:       Major (& Embarrassing?)
  6100. Problem:        Incorrect forward referencing when analysing SPECs in
  6101.         functor arguments.
  6102.  
  6103. Input:
  6104.     signature SIG = sig  type t  end
  6105.  
  6106.     functor F(structure STR1: sig type t end sharing type STR1.t = Foo.t
  6107.             structure Foo: SIG
  6108.            ) = struct end;
  6109.  
  6110. Output:
  6111.     functor F: <sig>
  6112.  
  6113. Status: fixed in 0.73
  6114. --------------------------------------------------------------------------------
  6115. 243. include compiler bug
  6116. Submitter: Nick Rothwell <nick@lfcs.edinburgh.ac.uk>
  6117. Date: Thu, 5 Jul 90 17:09:30 BST
  6118. Version: 0.59
  6119. Problem:
  6120.   The following file produces the error
  6121.  
  6122.     Compiler bug: Parse.includeSig.newTyc.
  6123. Code:
  6124. (* This "batch" file has been generated from the original
  6125.    sources by MAKE. If you want to make alterations, make them
  6126.    to the originals, and execute Make.make_task again. *)
  6127.  
  6128. (*$DECTREE_DT*)
  6129. (* Just the bare datatype for decision trees. *)
  6130.  
  6131. signature DECTREE_DT =
  6132.   sig
  6133.     type lab
  6134.     type lvar
  6135.     type longvar
  6136.     type longcon
  6137.     type longexcon
  6138.     type scon
  6139.     type pat
  6140.     type type_info
  6141.     eqtype (*pah!*) RuleNum sharing type RuleNum = int
  6142.     type Decision
  6143.     type (''a, 'b) map
  6144.  
  6145.     datatype 'a option = NONE | SOME of 'a
  6146.  
  6147.     datatype DecisionTree =
  6148.         LAB_DECOMPOSE of {bind: lvar,
  6149.               parent: lvar,
  6150.               lab: lab,
  6151.               child: DecisionTree,
  6152.               info: type_info
  6153.              }
  6154.       | CON_DECOMPOSE of {bind: lvar, parent: lvar, child: DecisionTree}
  6155.       | EXCON_DECOMPOSE of {bind: lvar, parent: lvar, child: DecisionTree}
  6156.  
  6157.       | CON_SWITCH of {arg: lvar,
  6158.                selections: (longcon, DecisionTree) map,
  6159.                wildcard: DecisionTree option,
  6160.                 (* An `option' because we may notice that all
  6161.                    the constructors are present. *)
  6162.                info: type_info
  6163.               }
  6164.       | SCON_SWITCH of {arg: lvar,
  6165.             selections: (scon, DecisionTree) map,
  6166.             wildcard: DecisionTree
  6167.                }
  6168.       | EXCON_SWITCH of {arg: lvar,
  6169.              selections: (longexcon * DecisionTree) list,
  6170.              wildcard: DecisionTree
  6171.             }
  6172.  
  6173.       | END of {ruleNum: RuleNum,
  6174.         environment: (longvar, lvar) map
  6175.            }
  6176.  
  6177.       | FAIL
  6178.   end;
  6179.  
  6180. (*$MATCH_COMPILER: DECTREE_DT*)
  6181.  
  6182. (* The match compiler interface; the actual match compiler is built from
  6183.    a number of sub-functors, but this top-level interface is the only one
  6184.    which the rest of the compiler cares about. Given a series of patterns,
  6185.    it returns a DecisionTree (which is essentially an abstract form of the
  6186.    final lambda-code), in which all the lvars for identifiers and temporaries
  6187.    have been generated. At each leaf of the decision tree, there's a
  6188.    single rule number (the rule reached by this series of decisions), and an
  6189.    environment from identifiers to lvars, which is used to compile the
  6190.    right-hand-side expression for this rule. Nice, huh? *)
  6191.  
  6192. signature MATCH_COMPILER =
  6193.   sig
  6194.     include DECTREE_DT
  6195.  
  6196.     val matchCompiler:
  6197.       lvar * pat list * {warnInexhaustive: bool, warnNoBindings: bool}
  6198.       -> DecisionTree            (* these flags are set when the
  6199.                        warnings are required. *)
  6200.  
  6201.     type StringTree
  6202.     val layoutDecisionTree: DecisionTree -> StringTree
  6203.   end;
  6204.  
  6205. Status: fixed in 0.69
  6206. -------------------------------------------------------------------------------
  6207. 244. compiler bug on product of large integer constants on SPARC
  6208. Submitter:      Bennet Vance (bennet@cse.ogi.edu)
  6209. Date:        Jul  1, 1990
  6210. Version:        0.59
  6211. System:         Sun 4/60 - SunOS Release 4.0.3c
  6212. Severity:       minor
  6213. Problem:        compiler bug on large products of integer constants
  6214. Transcript:
  6215.  
  6216.     val it = () : unit
  6217.     - 2*268435455;
  6218.     val it = 536870910 : int
  6219.     - 2*268435456;
  6220.     Error: Compiler bug: [SparcCM.ashr]
  6221. Status: fixed in 0.61 (jhr)
  6222. --------------------------------------------------------------------------------
  6223. 245. NeXT installation problem
  6224. Submitter:      Lyman Taylor ( respond to lyman@portia.stanford.edu )
  6225. Date:        07/12/90
  6226. Version:        0.56
  6227. System:         NeXT , 8M , hard disk , & OD  ( build done on OD )
  6228. Severity:       major
  6229. Problem:        install script does not excute
  6230. Code:           none
  6231. Transcript:        following ouput of makeml ( machine name helen )
  6232.  
  6233. helen> makeml -next
  6234. makeml> (cd runtime; make clean)
  6235. rm -f *.o lint.out prim.s linkdata allmo.s run
  6236. makeml> rm -f mo
  6237. makeml> ln -s ../mo.m68 mo
  6238. makeml> (cd runtime; rm -f run allmo.o)
  6239. makeml> (cd runtime; make MACHINE=M68 'DEFS= -DBSD -DNeXT -DRUNTIME=\"runtime\"' linkdata)
  6240. cc -O  -DM68 -DBSD -DNeXT -DRUNTIME=\"runtime\" -o linkdata linkdata.c
  6241. makeml> runtime/linkdata [runtime/IntM68.mos]
  6242. runtime/linkdata> as runtime/allmo.s -o runtime/allmo.o
  6243. makeml> (cd runtime; make MACHINE=M68 'DEFS= -DBSD -DNeXT' CPP=/lib/cpp 'CFL=' 'AS=as')
  6244. cc -O  -DM68 -DBSD -DNeXT -c run.c
  6245. ml_os.h:113: can't find include file `sys/syscall.h'
  6246. *** Exit 1
  6247. Stop.
  6248.  
  6249. Comments:    I'm not skilled at development for the NeXT. I was just looking
  6250.         to compile the latest version of SMLNJ so I could try it out
  6251.         there is an older version ( 0.43 ) on the Sparcs around here
  6252.         but the Next allows me to dump all this onto an OD so noone 
  6253.         can complain about the space all the source is taking up.
  6254.             
  6255. Status: fixed in 0.59 (jhr)
  6256. --------------------------------------------------------------------------------
  6257. 246. repeated import consumes too much memory
  6258. Submitter:      Peter Canning  <canning@hplabs.hp.com>
  6259. Date:        27 June 1990
  6260. Version:        0.56
  6261. System:         HP900S370 (m68030)  HP-UX 7.0
  6262. Severity:       major
  6263. Problem:        repeated use of the import facility causes the heap to grow
  6264. Comments:
  6265.     In particular, if I repeatedly modify a file, import the file, then run the
  6266.     program defined in the file (the standard edit/compile/debug loop), my sml
  6267.     image seems to grow (and never shink again).  When I was just using "use",
  6268.     sml would garbage collect freqently, but the process size would stay between
  6269.     4000 and 5000 Kbytes.  Using import (working on the same program), the
  6270.     process has grown as large as 11000 Kbytes.  It appears that for some reason
  6271.     some data related to importing/compiling files is not being reclaimed by the
  6272.     garbage collector.
  6273. Status: Fixed (defunct feature)
  6274. --------------------------------------------------------------------------------
  6275. 247. close_out std_out
  6276. Submitter: Mark R. Leone  <mleone@cs.cmu.edu>
  6277. Date: Fri, 29 Jun 90 16:09:02 EDT
  6278. Version: 0.59
  6279. Problem:
  6280.   If standard output is closed, the top level exits ungracefully:
  6281. Transcript:
  6282.     [r.ergo]/usr/mleone/sml/hypo-pl> sml
  6283.     Standard ML of New Jersey, Version 0.59, 4 June 1990
  6284.     Warning: input and output are now uncurried, arithmetic exceptions
  6285.     are re-arranged, div and mod are different; see doc/NEWS
  6286.     val it = () : unit
  6287.     - close_out std_out;
  6288.     Uncaught exception Io with "output "<std_out>": closed outstream"
  6289. Status: not a bug
  6290. --------------------------------------------------------------------------------
  6291. 248. abstract types are not abstract
  6292. Submitter:      Dave MacQueen
  6293. Date:        7/16/90
  6294. Version:        0.59 (0.57 and later)
  6295. Severity:       major
  6296. Problem:
  6297.    Abstract types defined by abstype declarations are not made abstract
  6298.   (i.e. converted from DATAtyc to ABStyc form), and their equality property
  6299.   is not reset to NO.  Equality properties of types defined in terms of the
  6300.   abstype are not recomputed (see bug 231.)
  6301. Comments:
  6302.   After the abstype body has been processed, the concrete form of the abstract
  6303.   types must be replaced by the abstract form throughout the 'signature' of the
  6304.   exported bindings (values, constructors, types).  Also equality properties
  6305.   of exported types have to be reevaluated.
  6306.   Currently, there is a function that attempts to transform the tycons in the
  6307.   type checker, but it affects only the abstract syntax, and not the static
  6308.   environment.  The problem results from the removal of the ref around tycons
  6309.   in 0.57.
  6310. Status: fixed in 0.64.
  6311. --------------------------------------------------------------------------------
  6312. 249. separate compilation printing problems
  6313. Submitter:      Nick Rothwell <nick@lfcs.ed.ac.uk> (also Richard O'Neill)
  6314. Date:        7/5/90
  6315. Version:        0.59
  6316. Severity:       minor
  6317. Problem:
  6318.     0. If only one or other of the files exists (say, Foo.sml without Foo.bin
  6319.     or vice versa), the exception SystemCall gets raised.
  6320.  
  6321.     1. The error message
  6322.  
  6323.         [Foo.bin is in the wrong format; recompiling]
  6324.  
  6325.     seems to have lost its closing "]" in 0.59.
  6326.  
  6327.     2. The final bindings from a separately compiled module get
  6328.     printed on one line, as in:
  6329.  
  6330.     signature Asignature Bsignature Csignature D- 
  6331.  
  6332.     rather than
  6333.  
  6334.     signature A
  6335.     signature B
  6336.     etc.
  6337. Fix:  (Richard O'Neill)
  6338.     For some reason the function printBindingTbl in print/printdec.sml was changed
  6339.     from its form in release 0.56 to a slightly modified forn in 0.59. The new
  6340.     form is functionally equivalent appart from omiting to generate newlines.
  6341.  
  6342.     Fix (currently untried):
  6343.  
  6344.     Return printBindingTbl to it 0.56 form.
  6345. Status: fixed in 0.64(?)
  6346. --------------------------------------------------------------------------------
  6347. 250. interpreter broken
  6348. Submitter:      Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
  6349. Date:        Tue Jul 17 12:24:19 BST 1990
  6350. Version:        0.59
  6351. System:         Sun3, SunOS 4.1
  6352. Severity:       Major
  6353. Problem:
  6354.  
  6355. In interpret mode, version 0.59 fails with no explanation when compiling a
  6356. grammar from mlyacc (slightly modified to use 'import'), whilst in compile
  6357. mode, the grammar is compiled correctly. Version 0.56 does not exhibit the same
  6358. problem.
  6359.  
  6360. This seems a significant problem since using compile mode takes significant
  6361. time and memory. Equally, I cannot use version 0.56 due to some of its bugs
  6362. which manifest themselves when compiling other modules.
  6363.  
  6364. I have not included the files as they are rather long (being an mlyacc 
  6365. generated parser and the relevant support files). I can supply you with a
  6366. uuencoded compressed tar archive of them all if you desire.
  6367.  
  6368. Transcript:
  6369.  
  6370. unix% sml
  6371. Standard ML of New Jersey, Version 0.59, 4 June 1990
  6372. - System.Control.interp;
  6373. val it = ref true : bool ref
  6374. - import "clean.grm";
  6375. [clean.grm.bin is out of date; recompiling]
  6376. [reading clean.grm.sml]
  6377.   [reading lib/token.sig.bin... done]
  6378. [closing clean.grm.sml]
  6379. IMPORT failed (compile-time exception: SystemCall)
  6380. - import "clean.grm";
  6381. [clean.grm.bin is out of date; recompiling]
  6382. [reading clean.grm.sml]
  6383.   [reading lib/token.sig.bin... done]
  6384.   [reading clean.grm.sig.bin... done]
  6385.  
  6386. [Major collection... 60% used (648480/1067380), 1900 msec]
  6387.  
  6388. [Major collection... 96% used (1015412/1055228), 3000 msec]
  6389.  
  6390. [Increasing heap to 3088k]
  6391.  
  6392. [Major collection... 96% used (1526764/1586468), 4740 msec]
  6393.  
  6394. [Increasing heap to 4640k]
  6395.  
  6396. [Major collection... 96% used (2287536/2378284), 7480 msec]
  6397.  
  6398. [Increasing heap to 6952k]
  6399.  
  6400. [Major collection...
  6401. [Increasing heap to 10528k]
  6402.  96% used (3515248/3635044), 11120 msec]
  6403.  
  6404. [Increasing heap to 10632k]
  6405. [closing clean.grm.sml]
  6406. IMPORT failed (compile-time exception: Cascade)
  6407. - ^D
  6408.  
  6409. unix% old-sml
  6410. Standard ML of New Jersey, Version 0.56, 13 April 1990
  6411. val it = () : unit
  6412. - System.Control.interp;
  6413. val it = ref true : bool ref
  6414. - import "clean.grm";
  6415. [clean.grm.bin is out of date; recompiling]
  6416. [reading clean.grm.sml]
  6417.   [reading lib/token.sig.bin... ]
  6418.   [lib/token.sig.bin is the wrong format; recompiling]
  6419.   [closing lib/token.sig.bin]
  6420.   [reading lib/token.sig.sml]
  6421.     [reading lib/lrtable.sig.bin... ]
  6422.     [lib/lrtable.sig.bin is the wrong format; recompiling]
  6423.     [closing lib/lrtable.sig.bin]
  6424.     [reading lib/lrtable.sig.sml]
  6425.     [writing lib/lrtable.sig.bin... done]
  6426.     [closing lib/lrtable.sig.sml]
  6427.   [writing lib/token.sig.bin... done]
  6428.   [closing lib/token.sig.sml]
  6429.   [reading clean.grm.sig.bin... ]
  6430.   [clean.grm.sig.bin is the wrong format; recompiling]
  6431.   [closing clean.grm.sig.bin]
  6432.   [reading clean.grm.sig.sml]
  6433.     [reading lib/parserdata.sig.bin... ]
  6434.     [lib/parserdata.sig.bin is the wrong format; recompiling]
  6435.     [closing lib/parserdata.sig.bin]
  6436.     [reading lib/parserdata.sig.sml]
  6437.       [reading lib/token.sig.bin... ]
  6438.       [import(s) of lib/token.sig are out of date; recompiling]
  6439.       [closing lib/token.sig.bin]
  6440.       [reading lib/token.sig.sml]
  6441.         [reading lib/lrtable.sig.bin... done]
  6442.       [writing lib/token.sig.bin... done]
  6443.       [closing lib/token.sig.sml]
  6444.       [reading lib/lrtable.sig.bin... done]
  6445.     [writing lib/parserdata.sig.bin... done]
  6446.     [closing lib/parserdata.sig.sml]
  6447.   [writing clean.grm.sig.bin... done]
  6448.   [closing clean.grm.sig.sml]
  6449.  
  6450.  
  6451. [Major collection... 66% used (1058292/1581868), 3360 msec]
  6452.  
  6453. [Increasing heap to 3249k]
  6454.  
  6455. [Major collection... 96% used (1629952/1687576), 5020 msec]
  6456.  
  6457. [Increasing heap to 4929k]
  6458.  
  6459. [Major collection... 96% used (2478864/2562240), 7800 msec]
  6460.  
  6461. [Increasing heap to 7481k]
  6462.  
  6463. [Major collection... 30% used (1226344/3978648), 4200 msec]
  6464.  
  6465. [Decreasing heap to 4153k]
  6466.  
  6467. [Major collection... 92% used (1982616/2147092), 6060 msec]
  6468.  
  6469. [Increasing heap to 6081k]
  6470.  
  6471. [Major collection... 85% used (2731764/3199400), 8480 msec]
  6472.  
  6473. [Increasing heap to 8593k]
  6474.  
  6475. [Major collection... 62% used (2809816/4478688), 9180 msec]
  6476.  
  6477. [Increasing heap to 8657k]
  6478.  
  6479. [Major collection... 60% used (2770384/4573952), 8920 msec]
  6480.  
  6481. [Major collection... 62% used (2804296/4452412), 8980 msec]
  6482.  
  6483. [Increasing heap to 8721k]
  6484.  
  6485. [Major collection... 67% used (3031468/4473120), 8700 msec]
  6486.  
  6487. [Increasing heap to 9033k]
  6488. [writing clean.grm.bin... done]
  6489. [closing clean.grm.sml]
  6490. signature Clean_TOKENS
  6491. signature TOKEN
  6492. signature PARSER_DATA
  6493. signature Clean_LRVALS
  6494. signature LR_TABLE
  6495. functor CleanLrValsFun
  6496. - ^D
  6497.  
  6498. unix% sml
  6499. Standard ML of New Jersey, Version 0.59, 4 June 1990
  6500. - System.Control.interp := false;
  6501. val it = () : unit
  6502. - import "clean.grm";
  6503. [reading clean.grm.bin... ]
  6504. [clean.grm.bin is the wrong format; recompiling
  6505. [closing clean.grm.bin]
  6506. [reading clean.grm.sml]
  6507.   [reading lib/token.sig.bin... ]
  6508.   [lib/token.sig.bin is the wrong format; recompiling
  6509.   [closing lib/token.sig.bin]
  6510.   [reading lib/token.sig.sml]
  6511.     [reading lib/lrtable.sig.bin... ]
  6512.     [lib/lrtable.sig.bin is the wrong format; recompiling
  6513.     [closing lib/lrtable.sig.bin]
  6514.     [reading lib/lrtable.sig.sml]
  6515.     [writing lib/lrtable.sig.bin... done]
  6516.     [closing lib/lrtable.sig.sml]
  6517.   [writing lib/token.sig.bin... done]
  6518.   [closing lib/token.sig.sml]
  6519.   [reading clean.grm.sig.bin... ]
  6520.   [clean.grm.sig.bin is the wrong format; recompiling
  6521.   [closing clean.grm.sig.bin]
  6522.   [reading clean.grm.sig.sml]
  6523.     [reading lib/parserdata.sig.bin... ]
  6524.     [lib/parserdata.sig.bin is the wrong format; recompiling
  6525.     [closing lib/parserdata.sig.bin]
  6526.     [reading lib/parserdata.sig.sml]
  6527.       [reading lib/token.sig.bin... done]
  6528.       [reading lib/lrtable.sig.bin... done]
  6529.     [writing lib/parserdata.sig.bin... done]
  6530.     [closing lib/parserdata.sig.sml]
  6531.   [writing clean.grm.sig.bin... done]
  6532.   [closing clean.grm.sig.sml]
  6533.  
  6534. [Major collection... 61% used (679180/1109552), 2060 msec]
  6535.  
  6536. [Increasing heap to 2240k]
  6537.  
  6538. [Major collection... 80% used (932040/1158752), 2780 msec]
  6539.  
  6540. [Increasing heap to 2848k]
  6541.  
  6542. [Major collection... 95% used (1403328/1463408), 4240 msec]
  6543.  
  6544. [Increasing heap to 4272k]
  6545.  
  6546. [Major collection... 96% used (2109420/2194020), 6680 msec]
  6547.  
  6548. [Increasing heap to 6408k]
  6549.  
  6550. [Major collection...
  6551. [Increasing heap to 9656k]
  6552.  96% used (3255168/3361612), 10700 msec]
  6553.  
  6554. [Increasing heap to 9824k]
  6555.  
  6556. [Major collection... 36% used (1914068/5201708), 6400 msec]
  6557.  
  6558. [Decreasing heap to 6208k]
  6559.  
  6560. [Major collection... 85% used (2811340/3298792), 8620 msec]
  6561.  
  6562. [Increasing heap to 8816k]
  6563.  
  6564. [Major collection... 61% used (2810740/4607236), 8320 msec]
  6565.  
  6566. [Major collection... 63% used (2882812/4569184), 8900 msec]
  6567.  
  6568. [Increasing heap to 8928k]
  6569.  
  6570. [Major collection... 57% used (2705236/4669212), 8360 msec]
  6571.  
  6572. [Major collection... 61% used (2854268/4612180), 8560 msec]
  6573. [writing clean.grm.bin... done]
  6574. [closing clean.grm.sml]
  6575. signature Clean_TOKENSsignature TOKENsignature PARSER_DATAsignature Clean_LRVALSsignature LR_TABLEfunctor CleanLrValsFun-
  6576.  
  6577. Comment: import and interpreter mode are currently incompatible
  6578.  
  6579. Status: not a bug
  6580. -------------------------------------------------------------------------------
  6581. 251. omits tests for repeated bindings
  6582. Submitter:      Dave Berry db@lfcs.ed.ac.uk
  6583. Date:        18th July 1990
  6584. Version:        0.59
  6585. System:         All (I presume; actually tested on a Sun 3 with SunOS 4.0)
  6586. Severity:       minor
  6587. Problem:        omits tests for repeated bindings
  6588. Code:           
  6589.  
  6590. type t = int and t = string;
  6591.  
  6592. exception E and E;
  6593.  
  6594. val rec f = fn x => x + 1
  6595. and f = fn n => if n > 0 then 1 else n * f (n - 1);
  6596.  
  6597. Transcript:
  6598.  
  6599. - type t = int and t = string;
  6600. type  t = int
  6601. type  t = string
  6602.  
  6603. - exception E and E;
  6604. exception E
  6605. exception E
  6606.  
  6607. - val rec f = fn x => x + 1
  6608. = and f = fn n => if n > 0 then 1 else n * f (n - 1);
  6609. val f = fn : int -> int
  6610. val f = fn : int -> int
  6611.  
  6612. Comments:
  6613.  
  6614. I expect that few people would make these mistakes in "real"
  6615. code, but they might be more common when teaching.
  6616.  
  6617. The tests are made for repeated constructors in a datatype,
  6618. and in some (non-recursive?) value bindings, e.g.
  6619.  
  6620. - datatype a = A | A;
  6621. std_in:3.14-3.18 Error: duplicate constructor name
  6622.  
  6623. - val a = 1 and a = 2;
  6624. std_in:2.5-2.19 Error: duplicate variable-name `a' in pattern(s)
  6625.  
  6626. Page 9 is the relevant part of the definition.
  6627.  
  6628. Status: fixed in 0.65
  6629. --------------------------------------------------------------------------------
  6630. 252. include broken in 0.59
  6631. Submitter:      Nick
  6632. Date:        17 July '90
  6633. Version:        0.59
  6634. System:         Irrelevant
  6635. Severity:       Major
  6636. Problem:        Inclusion of signatures with shared types: >Blam!<.
  6637. Code:
  6638.  
  6639.         signature SIG1 = sig  type ty sharing type ty = int  end;
  6640.  
  6641.         signature SIG2 = sig  include SIG1  end;
  6642.  
  6643. Transcript:
  6644.  
  6645.         signature SIG1 =
  6646.           sig
  6647.             eqtype ty
  6648.           end
  6649.         Error: Compiler bug: Parse.includeSig.newTyc
  6650.  
  6651. Comments:    Works in 0.56 (which has different problems - see a previous
  6652.         report).
  6653. Status: fixed in 0.64
  6654. --------------------------------------------------------------------------------
  6655. 253.  SML Dumping core compiling mlyacc with -pervshare
  6656. Submitter:      Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
  6657. Date:        Wed Jul 18 16:18:47 BST 1990
  6658. Version:        0.59
  6659. System:         Sun3/50, SunOS 4.1
  6660. Severity:       You decide...
  6661. Problem:
  6662.  
  6663. Attempting to compile mlyacc (as supplied with version 0.56 of SML of NJ) 
  6664. with a '-pervshare' version of SML of NJ 0.59 causes a Segmentation Fault.
  6665.  
  6666. This does not seem to happen with the sharable SML compiler.
  6667.  
  6668. I have the core dump if that would help...
  6669.  
  6670. Status: fixed sometime between 0.59 and 0.74
  6671. --------------------------------------------------------------------------------
  6672. 254. failure to detect type error
  6673. Submitter:      Andrew Appel
  6674. Date:        7/23/90
  6675. Version:        0.60
  6676. Severity:       critical
  6677. Problem:        type error not detected
  6678. Code:
  6679.     signature SIG = sig
  6680.       type EA
  6681.       val fopt : ((EA * EA) -> unit) option
  6682.     end
  6683.  
  6684.     functor CPSgen(M: SIG) :  sig  end =
  6685.     struct
  6686.     val g = 
  6687.         case M.fopt
  6688.          of SOME f => let fun h x = f (x,x)
  6689.                in h
  6690.               end
  6691.     val x = g 2
  6692.     end
  6693. Comments:
  6694.    Caused by missing case in scan function in the definition of Unify.instantiate.
  6695. Status: fixed in 0.61 (dbm)
  6696. --------------------------------------------------------------------------------
  6697. 255. space leak with redeclaration of variables
  6698. Submitter: John Reppy
  6699. Date:       7/24/90
  6700. Version:   0.60
  6701. Severity:  major
  6702. Problem:
  6703.     I think that there is a space leak in the top-level loop/environment.
  6704.     If I keep redefining the same identifiers, the amount of live data
  6705.     grows, when it should be fairly constant.  I assume that the problem
  6706.     is that the top-level symbol table is holding onto something it shouldn't.
  6707. Transcript:
  6708. Here is a simple demonstration of the space leak (60 bytes/iteration):
  6709.  
  6710.   Standard ML of New Jersey, Version 0.60, 13 July 1990
  6711.   val it = () : unit
  6712.   - structure S = struct val _ = System.Unsafe.CInterface.gc 1 end;
  6713.  
  6714.   [Major collection... 98% used (516680/526692), 610 msec]
  6715.   structure S :
  6716.     sig
  6717.     end
  6718.   - structure S = struct val _ = System.Unsafe.CInterface.gc 1 end;
  6719.  
  6720.   [Major collection... 98% used (517100/525980), 550 msec]
  6721.   structure S :
  6722.     sig
  6723.     end
  6724.   - structure S = struct val _ = System.Unsafe.CInterface.gc 1 end;
  6725.  
  6726.   [Major collection... 98% used (517160/526388), 550 msec]
  6727.   structure S :
  6728.     sig
  6729.     end
  6730.   - structure S = struct val _ = System.Unsafe.CInterface.gc 1 end;
  6731.  
  6732.   [Major collection... 98% used (517220/526448), 550 msec]
  6733.   structure S :
  6734.     sig
  6735.     end
  6736.   - structure S = struct val _ = System.Unsafe.CInterface.gc 1 end;
  6737.  
  6738.   [Major collection... 98% used (517280/526508), 540 msec]
  6739.   structure S :
  6740.     sig
  6741.     end
  6742.  
  6743. Comment: (appel) This is the top-level line-number information, and
  6744.      is a few bytes per line, regardless of size of defined structures.
  6745. Status: fixed in 0.65 (actually, it's now a 48-byte leak)
  6746. -------------------------------------------------------------------------------
  6747. 256. mcopt compiler bug with improper function definition
  6748. Submitter: John Mitchell (jcm@iswim.stanford.edu)
  6749. Date:      7/24/90
  6750. Version:   0.60
  6751. Severity:  critical
  6752. Problem:
  6753.     Compiler bug "r_o in mcopt" raised as a result of improper clausal
  6754.     function definition.
  6755. Transcript:
  6756.     - datatype 'a stack = empty | stk of 'a *'a stack;
  6757.     datatype 'a   stack
  6758.     con empty : 'a stack
  6759.     con stk : 'a * 'a stack -> 'a stack
  6760.     - fun pop stk(e,s) = s;
  6761.     Error: Compiler bug: r_o in mcopt
  6762.  
  6763.     adding parens fixes the problem, so not serious as is:
  6764.  
  6765.     fun pop (stk (e,s)) = s;
  6766.     std_in:2.5-2.23 Warning: match not exhaustive
  6767.         stk (e,s) => ...
  6768.     val pop = fn : 'a stack -> 'a stack
  6769.  
  6770. Submitter:      Sergio Antoy, antoy@vtodie.cs.vt.edu
  6771. Date:        8/9/90
  6772. Version:        SML of NJ version number 056
  6773. System:         DEC3100 V2.2 (Rev. 15)
  6774. Severity:       
  6775. Problem:        "using" following file sml generates "Compiler bug" msg
  6776. Code:
  6777.         datatype 'a Xlist
  6778.           = Xnil
  6779.           | Xcons of 'a * 'a Xlist
  6780.           | Xappend of 'a Xlist * 'a Xlist;
  6781.  
  6782.         fun incr Xappend(Xnil,Xnil) = Xnil
  6783.           | incr Xappend(Xnil,Xcons(a,b)) = Xcons(a,b);
  6784. Transcript:
  6785.         goliat[8]% sml
  6786.         Standard ML of New Jersey, Version 0.56, 13 April 1990
  6787.         Warning: input and output are now uncurried, arithmetic exceptions
  6788.         are re-arranged, div and mod are different; see doc/NEWS
  6789.         val it = () : unit
  6790.         - use "trans.sml";
  6791.         [opening trans.sml]
  6792.         datatype 'a   Xlist
  6793.         con Xappend : 'a Xlist * 'a Xlist -> 'a Xlist
  6794.         con Xcons : 'a * 'a Xlist -> 'a Xlist
  6795.         con Xnil : 'a Xlist
  6796.         Error: Compiler bug: r_o in mcopt
  6797.         [closing trans.sml]
  6798.         -
  6799. Status: fixed in 0.62?
  6800. --------------------------------------------------------------------------------
  6801. 257. Compiler bug: EnvAccess.lookPath with imported functors (bug 214 again)
  6802. Submitter:      Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
  6803. Date:        Mon Jul 30 11:52:10 BST 1990
  6804. Version:        0,59, 0.60
  6805. System:         Sun3/180, SunOS 4.1
  6806. Severity:       Major
  6807. Problem:
  6808.  
  6809. Bug #214 ('Compiler bug: EnvAccess.lookPath occurs when printing a top level
  6810. result') has not been laid to rest, it still occurs with imported functors.
  6811.  
  6812. Transcript:
  6813.  
  6814. unix% cat > one.sml
  6815.  
  6816. functor classes () =
  6817.     struct
  6818.         datatype symbol_class = 
  6819.             DataClass of data_class
  6820.           | SpecialClass of special_class
  6821.             
  6822.         and data_class = Int | Real | Bool | String
  6823.         and special_class = Any | None
  6824.     end
  6825. ^D
  6826. unix% cat > two.sml
  6827.  
  6828. signature classes =
  6829.     sig
  6830.         datatype symbol_class = 
  6831.             DataClass of data_class
  6832.           | SpecialClass of special_class
  6833.             
  6834.         and data_class = Int | Real | Bool | String
  6835.         and special_class = Any | None
  6836.     end
  6837.  
  6838. functor nodes ( structure Classes : classes ) =
  6839.     struct
  6840.         structure Classes = Classes
  6841.         local
  6842.             open Classes
  6843.         in
  6844.             datatype node =
  6845.               ClassNode of symbol_class
  6846.             | ValueNode of data_class
  6847.         end
  6848.     end
  6849. ^D
  6850. unix% sml
  6851. Standard ML of New Jersey, Version 0.60, 13 July 1990
  6852. val it = () : unit
  6853. - import "one" "two";
  6854. [reading one.sml]
  6855. [writing one.bin... done]
  6856. [closing one.sml]
  6857. functor classes
  6858. [reading two.sml]
  6859. [writing two.bin... done]
  6860. [closing two.sml]
  6861. signature classes
  6862. functor nodes
  6863. - structure Classes = classes ()
  6864. = structure Nodes = nodes ( structure Classes = Classes )
  6865. = open Classes Nodes ;
  6866. structure Classes :
  6867.   sig
  6868.     datatype special_class
  6869.       con Any : special_class
  6870.       con None : special_class
  6871.     datatype symbol_class
  6872.       con DataClass : data_class -> symbol_class
  6873.       con SpecialClass : special_class -> symbol_class
  6874.     datatype data_class
  6875.       con Bool : data_class
  6876.       con Int : data_class
  6877.       con Real : data_class
  6878.       con String : data_class
  6879.   end
  6880. structure Nodes :
  6881.   sig
  6882.     structure Classes : sig...end
  6883.     datatype node
  6884.       con ClassNode : symbol_class -> node
  6885.       con ValueNode : data_class -> node
  6886.   end
  6887. open Classes Nodes
  6888. - ClassNode (DataClass Int);
  6889. val it = ClassNode Error: Compiler bug: EnvAccess.lookPath
  6890. - ValueNode Int;
  6891. val it = ValueNode Int : node
  6892. - ^D
  6893. unix% sml
  6894. Standard ML of New Jersey, Version 0.60, 13 July 1990
  6895. val it = () : unit
  6896. - app use ["one.sml","two.sml"];
  6897. [opening one.sml]
  6898. functor classes : <sig>
  6899. [closing one.sml]
  6900. [opening two.sml]
  6901. signature classes =
  6902.   sig
  6903.     datatype special_class
  6904.       con Any : special_class
  6905.       con None : special_class
  6906.     datatype symbol_class
  6907.       con DataClass : data_class -> symbol_class
  6908.       con SpecialClass : special_class -> symbol_class
  6909.     datatype data_class
  6910.       con Bool : data_class
  6911.       con Int : data_class
  6912.       con Real : data_class
  6913.       con String : data_class
  6914.   end
  6915. functor nodes : <sig>
  6916. [closing two.sml]
  6917. val it = () : unit
  6918. - structure Classes = classes ()
  6919. = structure Nodes = nodes ( structure Classes = Classes )
  6920. = open Classes Nodes ;
  6921. structure Classes :
  6922.   sig
  6923.     datatype special_class
  6924.       con Any : special_class
  6925.       con None : special_class
  6926.     datatype symbol_class
  6927.       con DataClass : data_class -> symbol_class
  6928.       con SpecialClass : special_class -> symbol_class
  6929.     datatype data_class
  6930.       con Bool : data_class
  6931.       con Int : data_class
  6932.       con Real : data_class
  6933.       con String : data_class
  6934.   end
  6935. structure Nodes :
  6936.   sig
  6937.     structure Classes : sig...end
  6938.     datatype node
  6939.       con ClassNode : symbol_class -> node
  6940.       con ValueNode : data_class -> node
  6941.   end
  6942. open Classes Nodes
  6943. - ClassNode (DataClass Int);
  6944. val it = ClassNode (DataClass Int) : node
  6945. - ValueNode Int;
  6946. val it = ValueNode Int : node
  6947. - ^D
  6948. --------------------------------------------------------------------------------
  6949. 258. System.Directory.cd failure
  6950. Submitter: Dave MacQueen
  6951. Date: 8/15/90
  6952. Version: 0.63
  6953. Problem:
  6954.   System.Directory.cd applied to nonexistent directory name raises uncaught
  6955.   exception
  6956. Transcript:
  6957.     - System.Directory.cd "foo";
  6958.     uncaught exception SysError
  6959.     -
  6960. Status: fixed in 0.65
  6961. --------------------------------------------------------------------------------
  6962. 259. uncaught exception Match compiling normperv.sml
  6963. Submitter:      Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
  6964. Date:        Tue Aug 14 10:04:21 BST 1990
  6965. Version:        0.63 (not in 0.62 or earlier)
  6966. System:         Sun3/180, SunOS 4.1
  6967. Severity:       Critical
  6968. Problem:
  6969.  
  6970. Version 0.63 has a new bug whereby it cannot compile dbguser/normperv.sml
  6971. This prevents creating the '-debug' version.
  6972.  
  6973. Transcript:
  6974.  
  6975. unix% sml
  6976. Standard ML of New Jersey, Version 0.63, 10 August 1990
  6977. val it = () : unit
  6978. - use "dbguser/normperv.sml";
  6979. [opening dbguser/normperv.sml]
  6980. [closing dbguser/normperv.sml]
  6981.  
  6982. uncaught exception Match
  6983. -
  6984.  
  6985. Comments:
  6986.  
  6987. Smlc, version 0.62, created the 680X0 '.mo' files from which a -pervshare
  6988. runtime system was built using gcc. This runtime system was then used to build
  6989. a normal and then a -debug system (which failed).
  6990.  
  6991. I've marked the severity as critical because it is a critical problem for this
  6992. version. For me however, its not so critical as I seem to be managing OK with
  6993. 0.62.
  6994. Status: apparently fixed as of 0.75
  6995. --------------------------------------------------------------------------------
  6996. 260. failure to raise overflow
  6997. Submitter: David.Tarditi@B.GP.CS.CMU.EDU
  6998. Date: Mon, 13 Aug 90 15:43:26 EDT
  6999. Version: 0.63?
  7000. Problem:
  7001. The following program should raise an Overflow exception on all
  7002. 32-bit 2's complement machines but it doesn't:
  7003. -------
  7004. fun exp 0 = 1 | exp i = 2 * exp (i-1);
  7005.  
  7006. val a = exp 29;
  7007. val minint = ~a + ~a;
  7008.  
  7009. (* should raise overflow *)
  7010.  
  7011. val test = minint div ~1;
  7012. -------
  7013. An overflow exception was not raised in version 0.59 on a Sun 3 running
  7014. Mach emluating 4.3 BSD.  It was raised in version 0.59 on a MicroVax 3
  7015. running Mach emulating 4.3 BSD.
  7016.  
  7017. Comments:
  7018.  
  7019. This is the only case where overflow can occur in division.  It occurs
  7020. since MININT = -(MAXINT+1) in 2's complement.  Division of MININT by -1 
  7021. causes an overflow.
  7022.  
  7023. Status: fixed in 0.64
  7024. -------------------------------------------------------------------------------
  7025. 261. Compiler Bug: abstractBody.abstractType 1 (assumed same as 234)
  7026. Submitter:    George Beshers, beshers@sun2.brc.uconn.edu
  7027. Date:        Aug 9, 1990
  7028. Version:    0.56, sparc
  7029. Severity:    Significant
  7030. Problem:    Compiler generates
  7031.     ``Regex.sml:21.17 Compiler Bug: abstractBody.abstractType 1''
  7032.         Note: this is somewhat delicate to reproduce.  If you
  7033.         break the following into files and start a clean sml
  7034.         and do "use Regex.sml;" it consistently generates
  7035.         the error.  However, if you *repeat* the use Regex.sml
  7036.         it compiles (however I have a lingering suspision about
  7037.         the correctness of the code produced...).
  7038.         On one occasion I tried "using" all the files in
  7039.         sequence and that worked OK, at least the working
  7040.         parts of the module did.
  7041.  
  7042.         Also I have tried to cut parts of the Regex.sml
  7043.         file and reproduce the error but without success.
  7044.         In particular, the error is dependent on at least
  7045.         some of the code appearing later in the file.
  7046.  
  7047. Code:
  7048.  
  7049. (*---------------------------- Ordinal.sml ---------------------*)
  7050.  
  7051.  
  7052. signature ORD_RANGE =
  7053.   sig
  7054.     type elem
  7055.     val ord : elem -> int
  7056.     and de_ord : int -> elem
  7057.   end
  7058.  
  7059. functor NatFn() : ORD_RANGE =
  7060.   struct
  7061.     type elem = int
  7062.     fun ord x = x
  7063.     fun de_ord x = x
  7064.   end
  7065.  
  7066. functor CharFn() : ORD_RANGE =
  7067.   struct
  7068.     type elem = string
  7069.     val ord = String.ord
  7070.     val de_ord = chr
  7071.   end
  7072.  
  7073.  
  7074. (*------------------------ BitSet.sml ---------------------------*)
  7075.  
  7076.  
  7077. import "Ordinal";
  7078.  
  7079. signature BITSET =
  7080.   sig
  7081.     structure Elem : ORD_RANGE
  7082.     exception NoSuchElement
  7083.     type bitset
  7084.     val empty: bitset
  7085.     and    singleton : Elem.elem -> bitset
  7086.     and range : Elem.elem * Elem.elem -> bitset
  7087.     and setFromList : Elem.elem list -> bitset
  7088.  
  7089.     and    exists : Elem.elem -> bitset -> bool
  7090.     and union : bitset * bitset -> bitset
  7091.     and intersect : bitset * bitset -> bitset
  7092.     and difference : bitset * bitset -> bitset
  7093.  
  7094.     val isempty : bitset -> bool
  7095.     and eq : bitset * bitset -> bool
  7096.     and subset : bitset * bitset -> bool
  7097.     and subset': bitset * bitset -> bool
  7098.  
  7099.     val select : bitset * (Elem.elem -> bool) -> bitset
  7100.     val lowest : bitset -> Elem.elem
  7101.     val lowest' : bitset -> Elem.elem -> Elem.elem
  7102.     val highest : bitset -> Elem.elem
  7103.     val highest' : bitset -> Elem.elem -> Elem.elem
  7104.     val totOrder : bitset * bitset -> bool
  7105.     val forall : bitset -> Elem.elem list
  7106.     val makeString : bitset -> string
  7107.   end;
  7108.  
  7109. (* trivialized version *)
  7110. functor BitSetFn(Elem1 : ORD_RANGE) : BITSET =
  7111.   struct
  7112.     structure Elem = Elem1
  7113.     local
  7114.       open Elem Bits
  7115.       val bits_per_int = 30;
  7116.       val all_bits = 1073741823        (* 077777777777 *)
  7117.     in
  7118.       datatype bitset = BS of {lo : int, hi : int, setx : int array}
  7119.       val empty = BS{lo = 0, hi = ~1, setx = array(0, 0)}
  7120.  
  7121.       fun singleton x = empty
  7122.  
  7123.       fun range(l, h) = empty
  7124.  
  7125.       fun exists x (BS{lo, hi, setx}) = false
  7126.  
  7127.       fun union(set1, set2) = empty
  7128.  
  7129.       exception NoSuchElement
  7130.  
  7131.       fun lowest (BS{lo,...}) = de_ord lo
  7132.  
  7133.       fun lowest' (BS{lo,...}) start = de_ord lo
  7134.  
  7135.       fun highest (BS{hi,...}) = de_ord hi
  7136.  
  7137.       fun highest' (BS{hi,...}) start = de_ord hi
  7138.  
  7139.       fun reduce bs = empty
  7140.  
  7141.       fun intersect(set1, set2) = empty
  7142.  
  7143.       fun difference(set1, set2) = empty
  7144.  
  7145.       fun isempty (BS{lo, hi,...}) = hi < lo
  7146.  
  7147.       fun eq (set1, set2) = true
  7148.  
  7149.       fun op subset(s1, s2) = isempty (reduce (difference (s1, s2)))
  7150.  
  7151.       fun op subset'(s1, s2) = isempty (reduce (difference (s1, s2)))
  7152.                andalso (not (isempty (reduce (difference (s2, s1)))))
  7153.  
  7154.       fun lowQuery (bs, q) =
  7155.         let
  7156.       val BS{lo, hi, setx} = bs
  7157.           val i = ref lo
  7158.         in
  7159.           de_ord (!i)
  7160.         end
  7161.       fun highQuery (bs, q) =
  7162.         let
  7163.       val BS{lo, hi, setx} = bs
  7164.           val i = ref hi
  7165.         in
  7166.           de_ord (!i)
  7167.         end
  7168.  
  7169.       fun select (bs, q) = bs
  7170.  
  7171.       fun totOrder (set1, set2) = true
  7172.  
  7173.       fun forall s = nil
  7174.  
  7175.       fun makeString s = ""
  7176.  
  7177.       fun setFromList (l' : Elem.elem list) = empty
  7178.     end
  7179.   end
  7180.  
  7181.  
  7182. (*------------------------------ RedBlack.sml ------------------*)
  7183.  
  7184. signature RED_BLACK =
  7185.   sig type tree
  7186.       type key
  7187.       val empty : tree
  7188.       val insert : key * tree -> tree
  7189.       val lookup : key * tree -> key
  7190.       exception notfound of key
  7191.   end
  7192.  
  7193. functor RedBlack(B : sig type key
  7194.              val > : key*key->bool
  7195.              end): RED_BLACK =
  7196. struct
  7197.  open B
  7198.  datatype color = RED | BLACK
  7199.  datatype tree = empty | tree of key * color * tree * tree
  7200.  exception notfound of key
  7201.  
  7202.  fun insert (key,t) =
  7203.   let fun f empty = tree(key,RED,empty,empty)
  7204.         | f (tree(k,BLACK,l,r)) =
  7205.         if key>k
  7206.         then case f r
  7207.          of r as tree(rk,RED, rl as tree(rlk,RED,rll,rlr),rr) =>
  7208.             (case l
  7209.              of tree(lk,RED,ll,lr) =>
  7210.                 tree(k,RED,tree(lk,BLACK,ll,lr),
  7211.                        tree(rk,BLACK,rl,rr))
  7212.               | _ => tree(rlk,BLACK,tree(k,RED,l,rll),
  7213.                         tree(rk,RED,rlr,rr)))
  7214.           | r as tree(rk,RED,rl, rr as tree(rrk,RED,rrl,rrr)) =>
  7215.             (case l
  7216.              of tree(lk,RED,ll,lr) =>
  7217.                 tree(k,RED,tree(lk,BLACK,ll,lr),
  7218.                        tree(rk,BLACK,rl,rr))
  7219.               | _ => tree(rk,BLACK,tree(k,RED,l,rl),rr))
  7220.               | r => tree(k,BLACK,l,r)
  7221.         else if k>key
  7222.         then case f l
  7223.              of l as tree(lk,RED,ll, lr as tree(lrk,RED,lrl,lrr)) =>
  7224.             (case r
  7225.              of tree(rk,RED,rl,rr) =>
  7226.                 tree(k,RED,tree(lk,BLACK,ll,lr),
  7227.                        tree(rk,BLACK,rl,rr))
  7228.               | _ => tree(lrk,BLACK,tree(lk,RED,ll,lrl),
  7229.                         tree(k,RED,lrr,r)))
  7230.           | l as tree(lk,RED, ll as tree(llk,RED,lll,llr), lr) =>
  7231.             (case r
  7232.              of tree(rk,RED,rl,rr) =>
  7233.                 tree(k,RED,tree(lk,BLACK,ll,lr),
  7234.                        tree(rk,BLACK,rl,rr))
  7235.               | _ => tree(lk,BLACK,ll,tree(k,RED,lr,r)))
  7236.               | l => tree(k,BLACK,l,r)
  7237.         else tree(key,BLACK,l,r)
  7238.         | f (tree(k,RED,l,r)) =
  7239.         if key>k then tree(k,RED,l, f r)
  7240.         else if k>key then tree(k,RED, f l, r)
  7241.         else tree(key,RED,l,r)
  7242.    in case f t
  7243.       of tree(k,RED, l as tree(_,RED,_,_), r) => tree(k,BLACK,l,r)
  7244.        | tree(k,RED, l, r as tree(_,RED,_,_)) => tree(k,BLACK,l,r)
  7245.        | t => t
  7246.   end
  7247.  
  7248.  
  7249.  fun lookup (key,t) =
  7250.   let fun look empty = raise (notfound key)
  7251.     | look (tree(k,_,l,r)) =
  7252.         if k>key then look l
  7253.         else if key>k then look r
  7254.         else k
  7255.    in look t
  7256.   end
  7257.  
  7258. end
  7259.  
  7260.  
  7261. (*------------------------ Regex.sml ------------------------*)
  7262.  
  7263.  
  7264. import "Ordinal";
  7265. import "BitSet";
  7266. import "RedBlack";
  7267.  
  7268. signature CHAR_REG_EXP =
  7269.   sig
  7270.     structure Alphabet : ORD_RANGE
  7271.     structure AlphaSet : BITSET
  7272.     structure range : ORD_RANGE
  7273.     structure Set : BITSET
  7274.     sharing type Set.Elem.elem = range.elem = int
  7275.  
  7276.     type pattern
  7277.  
  7278.     datatype Ch_Reg_Exp
  7279.       = CONCAT of Ch_Reg_Exp list
  7280.       | ALTERNATE of Ch_Reg_Exp list
  7281.       | STAR of Ch_Reg_Exp
  7282.       | PLUS of Ch_Reg_Exp
  7283.       | OPTION of Ch_Reg_Exp
  7284.       | LETTER of AlphaSet.bitset
  7285.       | AUG   (* For internal use only *)
  7286.  
  7287.     type Aug_Reg_Exp
  7288.  
  7289.     val re_to_Aug : Ch_Reg_Exp -> {aug_re : Aug_Reg_Exp, count : int,
  7290.                 leafList : Aug_Reg_Exp list}
  7291.  
  7292.     val Aug_to_Follow : {aug_re : Aug_Reg_Exp, count : int,
  7293.              leafList : Aug_Reg_Exp list} -> Set.bitset array
  7294.  
  7295.     val Build_FSM :  {aug_re : Aug_Reg_Exp, count : int,
  7296.              leafList : Aug_Reg_Exp list} * Set.bitset array
  7297.              -> pattern
  7298.  
  7299.     val Print : Aug_Reg_Exp -> unit
  7300.   end
  7301.  
  7302. functor Reg_ExpFn() (* : CHAR_REG_EXP *) =
  7303.   struct
  7304.       structure Alphabet = CharFn()
  7305.       structure AlphaSet : BITSET = BitSetFn(Alphabet)
  7306.       structure range = NatFn()
  7307.       structure Set : BITSET = BitSetFn(range)
  7308.  
  7309.       type InfoTy =
  7310.     {
  7311.       fp : Set.bitset,
  7312.       lp : Set.bitset,
  7313.       null : bool
  7314.     }
  7315.  
  7316.       datatype pattern = Pat
  7317.  
  7318.       datatype Ch_Reg_Exp
  7319.     = CONCAT of Ch_Reg_Exp list
  7320.     | ALTERNATE of Ch_Reg_Exp list
  7321.     | STAR of Ch_Reg_Exp
  7322.     | PLUS of Ch_Reg_Exp
  7323.     | OPTION of Ch_Reg_Exp
  7324.     | LETTER of AlphaSet.bitset
  7325.     | AUG       (* Internal use only *)
  7326.  
  7327.       datatype Aug_Reg_Exp
  7328.     = AugCONCAT of InfoTy * Aug_Reg_Exp list
  7329.     | AugALTERNATE of InfoTy * Aug_Reg_Exp list
  7330.     | AugSTAR of InfoTy * Aug_Reg_Exp
  7331.     | AugPLUS of InfoTy * Aug_Reg_Exp
  7332.     | AugOPTION of InfoTy * Aug_Reg_Exp
  7333.     | AugLETTER of InfoTy * AlphaSet.bitset
  7334.     | AugAUG of InfoTy
  7335.  
  7336.       fun mkInfo () =
  7337.      {
  7338.        Fpos = Set.empty,
  7339.        Lpos = Set.empty,
  7340.        Nullable = false
  7341.      }
  7342.  
  7343.       fun info (AugCONCAT(inf, _)) = inf
  7344.     | info (AugALTERNATE(inf, _)) = inf
  7345.     | info (AugSTAR(inf, _)) = inf
  7346.     | info (AugPLUS(inf, _)) = inf
  7347.     | info (AugOPTION(inf, _)) = inf
  7348.     | info (AugLETTER(inf, _)) = inf
  7349.     | info (AugAUG(inf)) = inf
  7350.  
  7351. (*      type 'a Aug = {aug_re : Aug_Reg_Exp, count : int,
  7352.          leafList : Aug_Reg_Exp list}
  7353. *)
  7354.       fun re_to_Aug re =
  7355.         let
  7356.       fun app_map cnt nil = (nil : Aug_Reg_Exp list, cnt, nil)
  7357.         | app_map cnt (hd::tl) =
  7358.           let
  7359.         val hd' = pass1(cnt, hd)
  7360.         val {aug_re=ar, count=c, leafList=le} = hd'
  7361.         val (arTl, cntTl, leTl) = app_map c tl
  7362.           in
  7363.         (ar::arTl, cntTl, le@leTl)
  7364.           end
  7365.       and pass1 (counter, CONCAT(re_l)) =
  7366.         let
  7367.           val (ar', cnt', le') = app_map counter re_l
  7368.           fun foldConcat (a, b) =
  7369.             let
  7370.               val {fp = fpA, lp = lpA, null = nuA} = a
  7371.               val {fp = fpB, lp = lpB, null = nuB} = b
  7372.               val n = nuA andalso nuB
  7373.               val fp' = if nuB then Set.union (fpA, fpB) else fpB
  7374.               val lp' = if nuA then Set.union (lpA, lpB) else lpA
  7375.             in
  7376.               print "foldConcat\n";
  7377.             print "    given A ";
  7378.               print "  fpA="; print (Set.makeString fpA);
  7379.               print "  lpA="; print (Set.makeString lpA);
  7380.               print nuA; print "\n";
  7381.             print "    given B ";
  7382.               print "  fpB="; print (Set.makeString fpB);
  7383.               print "  lpB="; print (Set.makeString lpB);
  7384.               print nuB; print "\n";
  7385.             print "    results ";
  7386.               print "  fp'="; print (Set.makeString fp');
  7387.               print "  lp'="; print (Set.makeString lp');
  7388.               print n; print "\n";
  7389.               {fp = fp', lp = lp', null = n}
  7390.             end
  7391.           val base = {fp = Set.empty, lp = Set.empty, null = true}
  7392.           val _ = (print "    base ";
  7393.               print "  fp'="; print (Set.makeString (#fp base));
  7394.               print "  lp'="; print (Set.makeString (#lp base));
  7395.               print (#null base); print "\n")
  7396.           val info = revfold foldConcat (map info ar') base
  7397.         in
  7398.           {aug_re = AugCONCAT(info, ar'), count = cnt',
  7399.               leafList = le'}
  7400.         end
  7401.         | pass1 (counter, ALTERNATE(re_l)) =
  7402.           let
  7403.             val (ar', cnt', le') = app_map counter re_l
  7404.             fun foldAlt (a, b) =
  7405.               let
  7406.             val {fp = hdA, lp = lpA, null = nuA} = a
  7407.             val {fp = hdB, lp = lpB, null = nuB} = b
  7408.               in
  7409.             {fp = Set.union (hdA, hdB),
  7410.              lp = Set.union (lpA, lpB),
  7411.              null = nuA orelse nuB}
  7412.               end
  7413.             val base = {fp = Set.empty, lp = Set.empty, null = false}
  7414.             val info = fold foldAlt (map info ar') base
  7415.                   in
  7416.             {aug_re = AugALTERNATE(info, ar'), count = cnt',
  7417.             leafList = le'}
  7418.           end
  7419.         | pass1 (counter, STAR(re)) =
  7420.           let
  7421.             val {aug_re=ar, count=c, leafList=le} = pass1(counter, re)
  7422.             val {fp = fp', lp = lp', null = nu} = info ar
  7423.             val info = {fp = fp', lp = lp', null = true}
  7424.                   in
  7425.             {aug_re = AugSTAR(info, ar), count = c, leafList = le}
  7426.           end
  7427.         | pass1 (counter, PLUS(re)) =
  7428.           let
  7429.             val {aug_re=ar, count=c, leafList=le} = pass1(counter, re)
  7430.             val {fp = fp', lp = lp', null = nu} = info ar
  7431.             val info = {fp = fp', lp = lp', null = nu}
  7432.                   in
  7433.             {aug_re = AugPLUS(info, ar), count = c, leafList = le}
  7434.           end
  7435.         | pass1 (counter, OPTION(re)) =
  7436.           let
  7437.             val {aug_re=ar, count=c, leafList=le} = pass1(counter, re)
  7438.             val {fp = fp', lp = lp', null = nu} = info ar
  7439.             val info = {fp = fp', lp = lp', null = true}
  7440.                   in
  7441.             {aug_re = AugOPTION(info, ar), count = c, leafList = le}
  7442.           end
  7443.         | pass1 (counter, LETTER(a)) =
  7444.           let
  7445.             val c = Set.singleton counter
  7446.             val info = {fp = c, lp = c, null = false}
  7447.             val aug_r = AugLETTER(info, a)
  7448.                   in
  7449.             {aug_re = aug_r, count = counter+1, leafList = [aug_r]}
  7450.           end
  7451.         | pass1 (counter, AUG) =
  7452.           let
  7453.             val c = Set.singleton counter
  7454.             val info = {fp = c, lp = c, null = false}
  7455.             val aug_r = AugAUG(info)
  7456.                   in
  7457.             {aug_re = aug_r, count = counter+1, leafList = [aug_r]}
  7458.           end
  7459.         in
  7460.       pass1 (0, CONCAT [re, AUG])
  7461.         end
  7462.  
  7463.  
  7464.  
  7465.       fun prFollow fp =
  7466.     let
  7467.       val l = Array.length fp
  7468.           fun prx i = (print i; print "  "; print (Set.makeString (fp sub i));
  7469.         print "\n")
  7470.       fun p i = if i < l then (prx i; p (i + 1)) else ()
  7471.     in
  7472.       p 0
  7473.     end
  7474.  
  7475.       fun Aug_to_Follow {aug_re, count, leafList} =
  7476.     let
  7477.       val followPos = array(count, Set.empty)
  7478.       val count = ref 0
  7479.       fun updSet fp i = update(followPos, i,
  7480.         Set.union(followPos sub i, fp))
  7481.       fun pass2 (AugCONCAT(inf, re_l)) =
  7482.         let
  7483.           fun foldConcat (x, y) =
  7484.             let
  7485.               val updList = Set.forall y
  7486.               val {fp, lp, ...} = info x
  7487.               val updSet' = updSet fp
  7488.               fun ms nil = ""
  7489.                 | ms (x::y) = (makestring x) ^ (ms y)
  7490.             in
  7491.               print ("[" ^ (ms updList) ^ "]" ^ "\n"); 
  7492.               print (Set.makeString lp ^ "\n");
  7493.               app updSet' updList;
  7494.               lp
  7495.             end
  7496.           val c = !count
  7497.         in
  7498.           inc count;
  7499.           print "before fold "; print c; print "\n";
  7500.           prFollow followPos; print "\n";
  7501.           revfold foldConcat re_l Set.empty;
  7502.           print "after fold "; print c; print "\n";
  7503.           prFollow followPos; print "\n";
  7504.           app pass2 re_l;
  7505.           print "after app "; print c; print "\n";
  7506.           prFollow followPos; print "\n"
  7507.         end
  7508.         | pass2 (AugALTERNATE(inf, re_l)) = app pass2 re_l
  7509.         | pass2 (AugSTAR(inf, re)) =
  7510.         let
  7511.           val {fp, lp, ...} = info re
  7512.           val updSet' = updSet fp
  7513.         in
  7514.           app updSet' (Set.forall lp);
  7515.           pass2 re
  7516.         end
  7517.         | pass2 (AugPLUS(inf, re)) =
  7518.         let
  7519.           val {fp, lp, ...} = info re
  7520.           val updSet' = updSet fp
  7521.         in
  7522.           app updSet' (Set.forall lp);
  7523.           pass2 re
  7524.         end
  7525.         | pass2 (AugOPTION(inf, re)) = pass2 re
  7526.         | pass2 (AugLETTER(inf, _)) = ()
  7527.         | pass2 (AugAUG(inf)) = ()
  7528.     in
  7529.       pass2 aug_re;
  7530.       followPos
  7531.         end
  7532.  
  7533.     datatype transition = TR of AlphaSet.bitset * state
  7534.     and state = ST of {posSet : Set.bitset,
  7535.                     stId : int,
  7536.                     trans : transition list}
  7537.     fun le (ST{posSet = pS1,...}, ST{posSet = pS2,...}) =
  7538.         Set.totOrder (pS1, pS2)
  7539.         fun getPosSet (ST{posSet,...}) = posSet
  7540.         structure table = RedBlack(struct type key = state
  7541.                       val op > = le end)
  7542.  
  7543.     fun Build_FSM ({aug_re, count, leafList}, followPos) =
  7544.       let
  7545.              (* get character set at position i *)
  7546.         fun cSetAt i =
  7547.           case nth (leafList, i) of
  7548.                 AugLETTER(inf, x) => x
  7549.           | AugAUG(_) => AlphaSet.empty
  7550.  
  7551.          (* test to see if character has transition at position i *)
  7552.         fun atPos c i = AlphaSet.exists c (cSetAt i)
  7553.  
  7554.          (* Is this position a final position *)
  7555.         fun final i =
  7556.           case nth (leafList, i) of
  7557.             AugAUG(_) => true
  7558.               | _ => false
  7559.  
  7560.          (* return only those elements which match query *)
  7561.         fun sublist query l =
  7562.           let
  7563.         fun ss nil = nil
  7564.               | ss (hd::tl) =
  7565.              let val x = (ss tl)
  7566.              in if query hd then hd::x else x
  7567.              end
  7568.           in
  7569.         ss l
  7570.               end
  7571.  
  7572.         val cnt = ref 1
  7573.  
  7574.         fun build_auto states unmarked =
  7575.           if unmarked = nil then states else
  7576.           let
  7577.             val T = hd unmarked
  7578.         val _ = print ("build_auto " ^ (Set.makeString T) ^ "\n")
  7579.         val allchar =
  7580.             let
  7581.               fun f (i, x)  = AlphaSet.union(cSetAt i, x)
  7582.             in
  7583.               fold f (Set.forall T) AlphaSet.empty
  7584.             end
  7585.         val _ = print ("    allchar = " ^ (AlphaSet.makeString allchar)
  7586.             ^ "\n");
  7587.         fun eachChar states unmarked trans allchar =
  7588.           if AlphaSet.isempty allchar then
  7589.             (states, unmarked, trans)
  7590.           else
  7591.             let
  7592.               val _ = print "eachChar\n"
  7593.               fun next cSet =
  7594.             let
  7595.               val x = AlphaSet.lowest cSet
  7596.               val _ = print ("next cSet=" ^
  7597.                   (AlphaSet.makeString cSet) ^ "  ")
  7598.               val _ = print (makestring (AlphaSet.Elem.ord x)
  7599.                    ^ "\n")
  7600.               val posSet = Set.select (T, atPos x)
  7601.               val _ = print "Check\n"
  7602.               fun findSet i ch =
  7603.                 if i = count then ch
  7604.                 else
  7605.                   let val y = if Set.exists i posSet then
  7606.                         AlphaSet.intersect(ch, cSetAt i)
  7607.                       else
  7608.                         AlphaSet.difference(ch, cSetAt i)
  7609.                   in
  7610.                 findSet (i + 1) y
  7611.                   end
  7612.             in
  7613.               (findSet 0 cSet, posSet)
  7614.             end (* next *)
  7615.  
  7616.               val (cSet, posSet) = next allchar
  7617.               val _ = print ("     cSet=" ^ (AlphaSet.makeString cSet)
  7618.                    ^ ", posSet = " ^ (Set.makeString posSet)
  7619.                    ^ "\n")
  7620.  
  7621.               fun makeU s =
  7622.             let
  7623.               fun f (i, x) = Set.union (followPos sub i, x)
  7624.             in
  7625.               fold f (Set.forall posSet) Set.empty
  7626.             end  (* makeU *)
  7627.  
  7628.               val U = makeU posSet
  7629.               val _ = print ("     U=" ^ (Set.makeString U) ^ "\n") 
  7630.  
  7631.  
  7632.               fun FindInsert st u =
  7633.             let
  7634.               val dummy = ST{posSet = u, stId = 0, trans = []}
  7635.             in
  7636.               (table.lookup(dummy, st), st, unmarked)
  7637.                 handle table.notfound _ =>
  7638.                   let
  7639.                 val u' = ST{posSet = u, stId = !cnt, trans=[]}
  7640.                 val st' = table.insert(u', st)
  7641.                   in
  7642.                 inc cnt;
  7643.                 (u', st', unmarked@[u])
  7644.                   end
  7645.             end  (* FindInsert *)
  7646.               val (ToState, states', unmarked') = FindInsert states U
  7647.               val trans' = TR(cSet, ToState)::trans
  7648.             in
  7649.               eachChar states' unmarked' trans'
  7650.              (AlphaSet.difference (allchar, cSet))
  7651.             end  (* eachChar *)
  7652.  
  7653.         val (states', unmarked', trans') =
  7654.             eachChar states unmarked [] allchar
  7655.         val dummy = ST{posSet = T, stId = 0, trans = []}
  7656.         val ST{stId = Tid,...} = table.lookup(dummy, states')
  7657.         val s = ST{posSet = T, stId = Tid, trans = trans'}
  7658.         val states2 = table.insert(s, states')
  7659.           in
  7660.         build_auto states' (tl unmarked')
  7661.           end  (* build_auto *)
  7662.         val {fp = st',...} = info aug_re
  7663.         val startstate = ST{posSet = st', stId = 0, trans = []}
  7664.         val stTable = table.insert (startstate, table.empty)
  7665.         val autoList = build_auto stTable [st']
  7666.       in
  7667.         autoList
  7668.       end
  7669.  
  7670.       fun Print re =
  7671.         let
  7672.           val depth = ref 0
  7673.           fun printInfo ({fp, lp, null} : InfoTy) =
  7674.           (
  7675.         print "Fpos=";
  7676.         print (Set.makeString (fp));
  7677.         print "  Lpos=";
  7678.         print (Set.makeString (lp));
  7679.         if null then
  7680.           print "  nullable\n"
  7681.         else
  7682.           print "\n"
  7683.           )
  7684.       fun Pr (AugCONCAT(inf, re_l)) =
  7685.           (
  7686.         print "CONCAT  ";
  7687.         printInfo inf;
  7688.             app Pr1 re_l
  7689.           )
  7690.         | Pr (AugALTERNATE(inf, re_l)) =
  7691.           (
  7692.         print "ALTERN  ";
  7693.         printInfo inf;
  7694.             app Pr1 re_l
  7695.           )
  7696.         | Pr (AugSTAR(inf, re)) =
  7697.           (
  7698.         print "KLEENE  ";
  7699.         printInfo inf;
  7700.             Pr1 re
  7701.           )
  7702.         | Pr (AugPLUS(inf, re)) =
  7703.           (
  7704.         print "POSITV  ";
  7705.         printInfo inf;
  7706.             Pr1 re
  7707.           )
  7708.         | Pr (AugOPTION(inf, re)) =
  7709.           (
  7710.         print "OPTION  ";
  7711.         printInfo inf;
  7712.             Pr1 re
  7713.           )
  7714.         | Pr (AugLETTER(inf, _)) =
  7715.           (
  7716.         print "LETTER  ";
  7717.         printInfo inf
  7718.           )
  7719.         | Pr (AugAUG(inf)) =
  7720.           (
  7721.         print "AUGMEN  ";
  7722.         printInfo inf
  7723.           )
  7724.           and
  7725.           Pr1 x =
  7726.           let
  7727.         val i = ref 0;
  7728.           in
  7729.         (
  7730.           while (!i) < (!depth) do
  7731.             (print "  "; inc i);
  7732.           inc depth;
  7733.           Pr x;
  7734.           dec depth
  7735.             )
  7736.           end
  7737.         in
  7738.        Pr1 re
  7739.         end;
  7740.   end;
  7741.  
  7742.  
  7743. structure RRP_Test = Reg_ExpFn();
  7744.  
  7745. open RRP_Test;
  7746.  
  7747. val a = LETTER(AlphaSet.singleton "a")
  7748. val b = LETTER(AlphaSet.singleton "b")
  7749. val c = LETTER(AlphaSet.singleton "c")
  7750. val d = LETTER(AlphaSet.singleton "d")
  7751.  
  7752. val a_b_c = ALTERNATE([a, b, c]);
  7753. val aug = re_to_Aug a_b_c;
  7754. Print (#aug_re aug);
  7755. val fol = Aug_to_Follow aug;
  7756. prFollow fol;
  7757. print "Before Build_FSM\n";
  7758. val t = Build_FSM(aug, fol);
  7759.  
  7760. print "\n\n\n";
  7761. val abc = CONCAT([a, b, c]);
  7762. val aug' = re_to_Aug abc;
  7763. Print (#aug_re aug');
  7764. val fol' = Aug_to_Follow aug';
  7765. prFollow fol';
  7766. val t' = Build_FSM(aug', fol');
  7767.  
  7768. Status: fixed in 0.64
  7769. -------------------------------------------------------------------------------
  7770. 262. Using the LIBRARY with v0.62
  7771. Submitter: "Soren P. Christensen" <schristensen@daimi.aau.dk>
  7772. Date: Wed, 8 Aug 90 14:28:49 +0200
  7773. Problem:
  7774. I just tried to build the library found in /dist/ml/LIBRARY.tar.Z and
  7775. this fails.  We are using a spark version of 0.62.  I am not dependent
  7776. on the Library and the reson I report this is only so that you can use
  7777. it in your testing.
  7778.  
  7779. I had to make small changes like the definition of the quit function by
  7780. means of cleanup.
  7781.  
  7782. 1)
  7783.    There seems to be problems with the exceptions.
  7784.  
  7785. ---------------
  7786. Transcript:
  7787. Standard ML of New Jersey, Version 0.62, 1 August 1990
  7788. val it = () : unit
  7789. - fn () => (() handle Interrupt=>());
  7790. val it = fn : unit -> unit
  7791. - exception xx = Interrupt;
  7792. std_in:3.16-3.24 Error: unbound exn: Interrupt
  7793. - raise Interrupt;
  7794. std_in:1.7-1.15 Error: unbound variable Interrupt
  7795. std_in:1.1-1.15 Error: argument of raise is not an exception
  7796.   raised: undef
  7797.   in expression:
  7798.     raise Interrupt
  7799.  
  7800. ----------------
  7801.  
  7802. 2)
  7803.    later on it terminates with a runbind, I think this is related to the 
  7804. exceptions too.
  7805. Comments:
  7806.   (1) The Interrupt exception constructor has gone away, and Interrupt
  7807.   handling should be replaced by handling the interrupt signal.
  7808.   (2) The runbind exception seems to be a genuine bug.
  7809. Status: fixed in 0.65
  7810. -------------------------------------------------------------------------------
  7811. 263. problem with input via datakit con
  7812. Submitter: pjw
  7813. Date: 8/8/90
  7814. Transcript:
  7815. con tempel
  7816. connected to tempel.mesgdcon on /net/dk/4
  7817. $ cd /usr/dbm/sml/60/src
  7818. $ sml
  7819. Standard ML of New Jersey, Version 0.60, 13 July 1990
  7820. val it = () : unit
  7821. - -3;
  7822. std_in:2.1 Error: nonfix identifier required
  7823. std_in:2.1-2.2 Error: operator and operand don't agree (tycon mismatch)
  7824.   operator domain: 'Z * 'Z
  7825.   operand:         int
  7826.   in expression:
  7827.     - 3
  7828. std_in:2.1 Error: overloaded variable "-" cannot be resolved
  7829. uncaught Io exception (Loader): input "<std_in>": negative character count
  7830. Status: fixed in 0.65
  7831. --------------------------------------------------------------------------------
  7832. 264. No type-explicitness check in nj-sml
  7833. Submitter: David Turner <dnt@lfcs.edinburgh.ac.uk>
  7834. Date: 7/8/90
  7835. Version  : SML of NJ 0.56 and 0.59
  7836. System   : Sun
  7837. Severity : Dunno, but its pretty anti-social
  7838.  
  7839. Problem :
  7840.  
  7841.    The compiler doesn't seem to check for type explicitness in
  7842.    signatures (see section 5.8 and also rule 65 of the ML definition).
  7843.    This means many signatures which can never be matched are still
  7844.    accepted as valid signatures.
  7845.  
  7846. Transcript :
  7847.  
  7848.   - signature X = sig type t val x : t type t end;
  7849.   signature X =
  7850.     sig
  7851.       type t
  7852.       val x : ?.t
  7853.     end
  7854.  
  7855. Status: fixed in 0.73
  7856. --------------------------------------------------------------------------------
  7857. 265. strong type variables accepted in exception declarations
  7858. Submitter:      Dave Berry, db@lfcs.ed.ac.uk
  7859. Date:        Aug  7 1990
  7860. Version:        0.56, 0.59
  7861. Severity:       Minor (although it presumably means that the type system
  7862.         can be broken!)
  7863. Problem:        The compiler doesn't reject applicative type variables
  7864.         in exception declarations.
  7865. Code:           val id: 'a -> 'a =
  7866.           let exception dummy of 'a
  7867.           in fn x => x
  7868.           end;
  7869. Transcript:     The above code produces:
  7870.         val id = fn : 'a -> 'a
  7871.  
  7872. Status: fixed in 0.65
  7873. --------------------------------------------------------------------------------
  7874. 266. uncaught Io exception in use
  7875. From: John Reppy
  7876. Date: Mon, 6 Aug 90 18:53:48 EDT
  7877. System: 0.62
  7878. Problem:
  7879. I've noticed the following new (I think) bug.  An Io error in use results
  7880. in an uncaught exception.
  7881.  
  7882.   Standard ML of New Jersey, Version 0.62, 1 August 1990
  7883.   val it = () : unit
  7884.   - use "foo";
  7885.   [cannot open foo]
  7886.  
  7887.   uncaught exception Io "open_in "foo": open failed, No such file or directory"
  7888.  
  7889. The problem is that in "use_file" in build/interact.sml (line 307), the
  7890. exception Io gets re-raised.  Was this changed for the debugger?
  7891. [dbm, 8/30/90] Fixed so that exceptions are handled even for nonterminal
  7892. input.
  7893.  
  7894. Status: fixed in 0.65
  7895. -------------------------------------------------------------------------------
  7896. 267. sharing again
  7897. From: Simon Finn <simon@abstract-hardware-ltd.co.uk>
  7898. Date: Thu, 2 Aug 90 10:48:47 BST
  7899. Version: d64
  7900. Problem:
  7901. The following program breaks Poly/ML v1.88 and  NJML v0.44a (the most recent version
  7902. to which I have access) [breaks d64 as well].
  7903. Code:
  7904. signature S1 =
  7905. sig
  7906.   eqtype t
  7907.   val x : t
  7908. end;
  7909.  
  7910. signature S2 =
  7911. sig
  7912.   structure A : sig end
  7913.   structure C : sig structure A : S1 end
  7914.   sharing A = C.A
  7915. end;
  7916.  
  7917. functor F(structure A:S1
  7918.           structure B:S2
  7919.           sharing A = B.A)  =
  7920. struct
  7921.   val y = (A.x = B.C.A.x)
  7922. end;
  7923.  
  7924. Transcript:
  7925. Standard ML of New Jersey, Version d64, ? August 1990
  7926. val it = () : unit
  7927. - signature S1 =
  7928.   sig
  7929.     eqtype t
  7930.     val x : t
  7931.   end
  7932. signature S2 =
  7933.   sig
  7934.     structure A : sig...end
  7935.     structure C : sig...end
  7936.   end
  7937. std_in:21.11-21.25 Error: operator and operand don't agree (tycon mismatch)
  7938.   operator domain: ?.t * ?.t
  7939.   operand:         ?.t * ?.t
  7940.   in expression:
  7941.     = (A.x,B.C.A.x)
  7942.  
  7943. Comment:
  7944. This program is valid, since structure A shares with B.A which shares with B.C.A,
  7945. hence A.t and B.C.A.t must be the same (equality) type. However:
  7946.  
  7947. Status: fixed in 0.73
  7948. --------------------------------------------------------------------------------
  7949. 268. import, equality
  7950. Submitter:      Jason Fischl <fischl@cpsc.ucalgary.ca>
  7951. Date:        April 9, 1990
  7952. Version:        0.44
  7953. System:         Sparcstation 1
  7954. Severity:       major
  7955.  
  7956. Problem:       
  7957.  
  7958. The module system has a bug in it with regard to equality types (I think).
  7959. The following is a pretty concise description of what will cause the bug to
  7960. occur.  
  7961.  
  7962.  
  7963. Code:           
  7964. (*-----------------FILE:  term.sig.sml----------------------*)
  7965.  
  7966. signature termsig =
  7967. sig
  7968.  
  7969. datatype term =
  7970.     Const of string
  7971.   | Var of string
  7972.   | Func of string * term list
  7973.  
  7974. end;
  7975.  
  7976. (*--------------FILE:  term.sml-------------------------*)
  7977.  
  7978. import "term.sig";
  7979.  
  7980. functor termFC ():termsig =
  7981.  
  7982. struct
  7983.  
  7984. datatype term =
  7985.     Const of string
  7986.   | Var of string
  7987.   | Func of string * term list
  7988.  
  7989. end;
  7990.  
  7991. (*------------FILE: parse_term.sml---------------------------*)
  7992.  
  7993. import "term.sig";
  7994.  
  7995. functor parse_termFC (structure TERM:termsig) =
  7996. struct
  7997.  
  7998. open TERM
  7999.  
  8000. fun term_nil x = (x:term list) = []
  8001.  
  8002. end;
  8003.  
  8004. (*---------------------------------------*)
  8005.  
  8006.  
  8007. Transcript:     
  8008.  
  8009. - import "parse_term";
  8010. [parse_term.bin is out of date; recompiling]
  8011. [reading parse_term.sml]
  8012.   [reading term.sig.bin... done]
  8013. parse_term.sml, line 11: Error: Compiler bug: tycStamp
  8014. equal: type = ?.term list
  8015. import: code generation failed
  8016. [closing parse_term.sml]
  8017. IMPORT failed (codegen)
  8018.  
  8019. Comments:
  8020.  
  8021. I couldn't find any reference to it in the bug reports so I had to assume it
  8022. was all new.  It would have been much nicer if the error message had been a bit
  8023. more descriptive.  All I knew was that it was a type problem.  There was no
  8024. info as to which line the error occurred on or which function or anything
  8025. really. 
  8026.  
  8027. I would appreciate a reply at some point if you could manage since I am curious
  8028. as to the nature of my problem.  Undoubtedly it will get me again!  
  8029.  
  8030. Fix:  
  8031.  
  8032. In order to fix the problem I had to define the fun term_nil inside the term
  8033. functor and then also put it in the termsig signature.  This took me on the
  8034. order of 8 hours to figure out!
  8035.  
  8036. Status: fixed before 0.65
  8037. -------------------------------------------------------------------------------
  8038. 269. failure in abstractBody with embedded signature
  8039. Submitter: Dave MacQueen
  8040. Date: 8/29/90
  8041. Version: 0.63
  8042. Code: 
  8043.     functor F() =
  8044.     struct
  8045.       datatype d = D
  8046.       structure A : sig type s val x : s * d end =
  8047.       struct
  8048.         datatype s = MKs
  8049.         val x = (MKs,D)
  8050.       end
  8051.     end;
  8052.  
  8053.     structure B = F();
  8054.  
  8055.     val (_,B.D) = B.A.x;
  8056. Transcript:
  8057.     - use "bug269.sml";
  8058.     [opening bug269.sml]
  8059.     functor F : <sig>
  8060.     structure B :
  8061.       sig
  8062.     structure A : sig...end
  8063.     datatype d
  8064.       con D : d
  8065.       end
  8066.     bug269.sml:16.5-16.19 Error: pattern and expression in val dec don't agree (tycon mis
  8067.     match)
  8068.       pattern:    B.A.s * B.d
  8069.       expression: B.A.s * ?.d
  8070.       in declaration:
  8071.     (_,D) = B.A.x
  8072.     [closing bug269.sml]
  8073.  
  8074. Status: fixed in 0.65
  8075. -------------------------------------------------------------------------------
  8076. 270. Compiler bug: TypesUtil.lookTycPath: NULLstr 
  8077. Submitter: Dave MacQueen
  8078. Date: 8/29/90
  8079. Version: 0.63
  8080. Problem:
  8081.    failure to interpret path for X.d in embedded signature
  8082.    Formal paramter X was not bound properly.
  8083. Code:
  8084.     functor F(X: sig datatype d = A end) =
  8085.     struct
  8086.       structure S : sig val x : X.d end =
  8087.     struct val x = X.A end
  8088.     end
  8089. Status: fixed in 0.65
  8090. -------------------------------------------------------------------------------
  8091. 271. secondary compiler bug
  8092. Submitter:      Gary T. Leavens leavens@bambam.cs.iastate.edu
  8093. Date:        8/29/90
  8094. Version:        0.64
  8095. System:         HP 9000/370, HP-UX 7.0
  8096. Severity:       minor
  8097. Problem:        get compiler bug report
  8098. Code:           the following in a file "report"
  8099.  
  8100. signature IntMapSig =
  8101.     sig
  8102.         type 'a map
  8103.         val apply: ('a map)*int -> 'a
  8104.         exception NotFound
  8105.     end;
  8106.  
  8107. signature ValueSig =
  8108.     sig
  8109.         type value
  8110.     end;
  8111.  
  8112. signature SymbolSig =
  8113.     sig
  8114.         type sym
  8115.         val hash: sym -> int
  8116.     end;
  8117.  
  8118. functor SymTblFct(structure IntMap: IntMapSig
  8119.                   structure Val: ValSig
  8120.                   structure Sym: SymSig):
  8121.     sig
  8122.         type table
  8123.         exception Lookup
  8124.         val lookup: table * Sym.sym -> Val.value
  8125.         val update: table * Sym.sym * Val.value -> table
  8126.     end =
  8127.     struct
  8128.         datatype table = TBL of (Sym.sym * Val.value)list IntMap.map
  8129.         exception Lookup
  8130.  
  8131.         fun find(sym,[]) = raise Lookup
  8132.          |   find(sym,(sym',v)::rest) =
  8133.               if sym = sym' then v else find(sym,rest);
  8134.  
  8135.         fun lookup(TBL map, s) =
  8136.             let val n = Sym.hash(s)
  8137.                 val l = IntMap.apply(map,n)
  8138.             in find(s,l)
  8139.             end handle IntMap.NotFound => raise Lookup
  8140.  
  8141.     (* ... *)
  8142.     end;
  8143.  
  8144. Transcript:     a transcript of session illustrating problem follows
  8145.  
  8146. Standard ML of New Jersey, Version 0.64, ? August 1990
  8147. val it = () : unit
  8148. - [opening report]
  8149. signature IntMapSig =
  8150.   sig
  8151.     type 'a map
  8152.     exception NotFound
  8153.     val apply : 'a map * int -> 'a
  8154.   end
  8155. signature ValueSig =
  8156.   sig
  8157.     type value
  8158.   end
  8159. signature SymbolSig =
  8160.   sig
  8161.     type sym
  8162.     val hash : sym -> int
  8163.   end
  8164. report:20.20-20.25 Error: unbound signature: ValSig
  8165. [closing report]
  8166. std_in:1.1 Compiler Bug: ModUtil.shiftStamps.newEnv - bad arg
  8167. -
  8168.  
  8169. Comments:  obviously the code has bugs, but I thought you'd want to see
  8170.     the "compiler bug" anyway, since it may be triggered by the bugs
  8171.     in the program.
  8172. Status: fixed in 0.65
  8173. -------------------------------------------------------------------------------
  8174. 272. generalizing user bound type variables
  8175. Submitter: Elsa
  8176. Date: 9/7/90
  8177. Version: 0.65
  8178. Problem: user bound variables are occurring in the final type of a function.
  8179. Code:
  8180.    fun f(x) = let val y : 'a -> 'a = x in y y end;
  8181. Transcript:     <transcript of session illustrating problem>
  8182.    - fun f(x) = let val y : 'a -> 'a = x in y y end;
  8183.    val f = fn : ('aU -> 'aU) -> 'a -> 'a   
  8184.    - f (fn x: 'a => x);
  8185.    std_in:2.1-2.16 Error: operator and operand don't agree (bound type var)
  8186.      operator domain: 'aU -> 'aU
  8187.      operand:          'aU -> 'aU
  8188.      in expression:
  8189.        f ((fn <pat> : 'aU => x))
  8190. Comments:
  8191.   Error should be detected when function f is defined, rather than when it
  8192.   is applied.
  8193. Status: fixed in 0.70
  8194. -------------------------------------------------------------------------------
  8195. 273. generalizing weak variables inside fn abstractions
  8196. Submitter: Dave MacQueen
  8197. Date: 10/3/90
  8198. Version: 0.52 and earlier
  8199. Problem: 
  8200.   let-bound variables were being generalized with too strong a weak type.
  8201. Transcript:
  8202.    - val x = fn y => let val f = ref in f end;
  8203.    val x = fn : 'a -> '3b -> '3b ref
  8204. Comments:
  8205.    Second bound type variable should be '2b instead of '3b.
  8206. Fix: 
  8207.    Added abs field to POLYty constructor to remember abstraction level at
  8208.    point where type generalization took place.
  8209. Status: fixed in 0.53
  8210. -------------------------------------------------------------------------------
  8211. 274. weakness lost with flex record pattern
  8212. Submitter: Colin Meldrum <colin@harlqn.co.uk>
  8213. Date: 3/19/90
  8214. Version: 0.66
  8215. Problem: flex record patterns can cause weakness to be dropped, resulting in
  8216.   whole in type system.
  8217. Code:
  8218.     - val a = 
  8219.       let val foo = ref nil
  8220.       in
  8221.     (fn x as {...} => foo:=[x] | (y,z) => ();
  8222.      foo)
  8223.       end
  8224.  
  8225.     > val a = ref [] : ('a * 'b) list ref
  8226. Comment:
  8227.     This is very unsafe and can for example allow the definition of a 'cast'
  8228.     function...
  8229.  
  8230.     fun cast (x) = ((a := (x,0) :: (!a)); #1(hd (!a)));
  8231. Status: fixed in 0.74
  8232. -------------------------------------------------------------------------------
  8233. 275. illegal token with structure named ?
  8234. Submitter: Nick Rothwell
  8235. Date: 3/16/90
  8236. Version: ?
  8237. Transcript:
  8238.     - structure ? = struct val x = 3 end;
  8239.     [succeeds]
  8240.  
  8241.     - ?.x;
  8242.     [fails with "illegal token"]
  8243.  
  8244.     - let open ? in x end;
  8245.     [succeeds]
  8246. Status: fixed by 0.66
  8247. -------------------------------------------------------------------------------
  8248. 276. overriding included value spec
  8249. Submitter: Dave Berry (db@lfcs.ed.ac.uk)
  8250. Date: 3/22/90
  8251. Version: 0.66
  8252. Severity: major
  8253. Problem:
  8254.     If a value spec in an included signature is redefined in the
  8255.     including signature, the value identifier keeps the type
  8256.     from the included signature, but it is printed as the type
  8257.     from the including signature.
  8258. Transcript:
  8259.       signature Foo1 =
  8260.       sig
  8261.         val foo: string
  8262.       end;
  8263.  
  8264.      signature Foo2 =
  8265.      sig
  8266.        include Foo1
  8267.        val foo: bool
  8268.      end;
  8269.  
  8270.      structure Foo: Foo2 =
  8271.      struct
  8272.        val foo = true
  8273.      end;
  8274.  
  8275.     Error: value type in structure doesn't match signature spec
  8276.       name: foo
  8277.       spec:   string
  8278.       actual: bool
  8279. Comments:
  8280.     Note:  Once I worked out what was going on I was actually grateful,
  8281.     because I hadn't realised that the names clashed.  Perhaps it
  8282.     would be useful if implementations could warn about such cases?
  8283. Status: fixed in 0.73
  8284. -------------------------------------------------------------------------------
  8285. 276. weak polymorphism
  8286. Submitter: Dave Berry (db@lfcs.ed.ac.uk)
  8287. Date: 3/22/90
  8288. Version: 0.44
  8289. Severity: major
  8290. Problem:
  8291. Code:           <example code that reproduces the problem>
  8292.     System.Control.weakUnderscore := true;
  8293.  
  8294.     structure RV:
  8295.       (* The bug doesn't appear if the signature isn't included. *)
  8296.       sig
  8297.     val create: int -> '_a -> '_a ref list
  8298.       end
  8299.     =
  8300.     struct
  8301.       (* The bug doesn't appear if the first arguiment is omitted (the code
  8302.      here doesn't use it, just to keep the example small. *)
  8303.       fun create size init = [ref init]
  8304.     end;
  8305.  
  8306.     (* The bug doesn't appear if this function is curried. *)
  8307.     fun extend (newmax, v) =
  8308.       RV.create newmax v;
  8309.  
  8310. Transcript: This is the output from the compiler:
  8311.  
  8312.     structure RV :
  8313.       sig
  8314.     val create : int -> '_a -> '_a ref list
  8315.       end
  8316.     nj-bug, line 17: Error: nongeneric weak type variable
  8317.       extend : int * '0S -> '0S ref list
  8318. Status: fixed in 0.70
  8319. -------------------------------------------------------------------------------
  8320. 277. incorrect "inconsistent equality property" error
  8321. Submitter: dbm
  8322. Date: 3/16/90
  8323. Version: 0.66
  8324. Severity: major
  8325. Problem:
  8326. Code: bug277.sml
  8327.     signature S1 =
  8328.     sig
  8329.       type d
  8330.     end;
  8331.  
  8332.     functor F(X: S1) :
  8333.     sig
  8334.       datatype a = C of X.d
  8335.     end =
  8336.     struct
  8337.       datatype a = C of X.d
  8338.       val f = fn (x : a) => x
  8339.     end;
  8340. Transcript:
  8341.    bug277.sml: 11.3-11.24 Error: inconsistent equality properties (2)
  8342. Status: fixed in 0.73
  8343. -------------------------------------------------------------------------------
  8344. 278. local structure declaration at top level
  8345. Submitter:      R. M. O'Neill (cmp7130@sys.uea.ac.uk)
  8346. Date:        3rd April 1990
  8347. Version:        0.44a
  8348. System:         Sun 3/50 & 3/160S SunOS 3.5
  8349. Severity:       Minor (but, should be easy to fix and I would prefer it fixed)
  8350.  
  8351. Problem:        
  8352.  
  8353. Using 'local ... in ... end' with structures does not work at the top level,
  8354. but does work when wrapped in a 'struct ... end' construct
  8355.  
  8356. Code:
  8357.   local
  8358.      structure Internal = struct val x=1 val y=2 end
  8359.   in
  8360.      structure First  : sig val x : int end = Internal
  8361.      structure Second : sig val y : int end = Internal
  8362.   end
  8363.  
  8364.   [** As a TOP-LEVEL declaration **]
  8365.  
  8366. Transcript:
  8367.  
  8368. -   local
  8369. =      structure Internal = struct val x=1 val y=2 end
  8370. Error: expected IN, found STRUCTURE
  8371. Error: expected END, found STRUCTURE
  8372. =   in
  8373. Error: declaration or expression expected, found IN
  8374. -      structure First  : sig val x : int end = Internal
  8375. =      structure Second : sig val y : int end = Internal
  8376. Error: unbound structure name: Internal
  8377. Error: unmatched val spec: x
  8378. =   end ;
  8379. Error: unbound structure name: Internal
  8380. Error: unmatched val spec: y
  8381. Error: declaration or expression expected, found END
  8382. -
  8383.  
  8384. Compare-With:
  8385.  
  8386. - structure Kludge = struct
  8387. =   local
  8388. =      structure Internal = struct val x=1 val y=2 end
  8389. =   in
  8390. =      structure First  : sig val x : int end = Internal
  8391. =      structure Second : sig val y : int end = Internal
  8392. =   end
  8393. = end ;
  8394. structure Kludge :
  8395.   sig
  8396.     structure First : sig...end
  8397.     structure Second : sig...end
  8398.   end
  8399. -
  8400.  
  8401. Comments:
  8402.  
  8403. Parser problem ? ( Expecting an 'ldec' rather than an 'sdec' ? )
  8404. [ I'm no SML internal workings guru !]
  8405.  
  8406. Status: fixed by 0.66
  8407. -------------------------------------------------------------------------------
  8408. 279. big integers causing uncaught exception
  8409. Submitter: John Reppy (jhr@cs.cornell.edu)
  8410. Date: 4/4/90
  8411. Version: 0.55
  8412. System: ?
  8413. Severity: major
  8414. Problem:
  8415.     There seems to be a problem in the compiler with integers that are larger
  8416.     than 2^29-1.
  8417. Transcript:
  8418.   Standard ML of New Jersey, Version 0.55, 1 April 1990
  8419.   val it = () : unit
  8420.   - fun f (i : int, two_i : int) = (
  8421.   =        print i; print ": "; print two_i; print "\n"; f(i+1, two_i+two_i));
  8422.   val f = fn : int * int -> 'a
  8423.   - f(0, 1);
  8424.   0: 1
  8425.   1: 2
  8426.   2: 4
  8427.   3: 8
  8428.    ...
  8429.   27: 134217728
  8430.   28: 268435456
  8431.   29: 536870912
  8432.   uncaught exception 
  8433.   - 536870912;
  8434.   uncaught exception 
  8435.   - 536870911;
  8436.   val it = 536870911 : int
  8437. Status: fixed in 0.66 on mipsb
  8438. -------------------------------------------------------------------------------
  8439. 280. included infix specs not printed
  8440. Submitter: John Reppy
  8441. Date: 4/17/90
  8442. Version: 0.56
  8443. Severity: minor
  8444. Problem:
  8445.     I noticed that if you include a signature that contains an infix
  8446.     specification, the infix specification doesn't get printed.
  8447. Code:
  8448. Transcript:
  8449.   - signature S1 = sig infix ## end;
  8450.   signature S1 =
  8451.     sig
  8452.       infix 0 ##
  8453.     end
  8454.   - signature S2 = sig include S1 end;
  8455.   signature S2 =
  8456.     sig
  8457.     end
  8458. Status: fixed in 0.73
  8459. -------------------------------------------------------------------------------
  8460. 281. Import bombs out when it can't find files.
  8461. Submitter:      Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
  8462. Date:        Tue Jul 17 11:01:09 BST 1990
  8463. Version:        0.59
  8464. System:         Sun3, SunOS 4.1
  8465. Severity:       You decide...
  8466. Problem:
  8467.  
  8468. Importing new files (ones which do not already have a '.bin' file) fails (with
  8469. an uncaught exception) whilst attempting to import files which do not exist
  8470. produces the same unfriendly message.
  8471.  
  8472. Transcript:
  8473.  
  8474. unix% ls
  8475. file.sml
  8476. unix% sml
  8477. Standard ML of New Jersey, Version 0.59, 4 June 1990
  8478. - import "file";
  8479.  
  8480. uncaught exception SystemCall
  8481. - import "nofile";
  8482.  
  8483. uncaught exception SystemCall
  8484. -
  8485.  
  8486. Perceived Reason:
  8487.  
  8488. The timeFile function in sepcomp/importer.sml believes that the SysIO.mtime
  8489. function will raise an Io exeption if it cannot find the file. In fact this
  8490. exception is never returned by any of the routines in the SysIO module. When
  8491. they encounter a problem they raise the SystemCall exception.
  8492.  
  8493. Fix (currently untried):
  8494.  
  8495. Option 1:
  8496.  
  8497. Change the code for timeFile to trap the SystemCall exeption instead of the
  8498. Io exception.
  8499.  
  8500. e.g.
  8501.  
  8502. <PATCH BEGIN>
  8503. *** sepcomp/importer.sml.orig   Fri Jun  1 14:08:02 1990
  8504. --- sepcomp/importer.sml        Tue Jul 17 10:29:22 1990
  8505. ***************
  8506. *** 159,165 ****
  8507.         in
  8508.           SOME sec
  8509.         end
  8510. !         handle (Io _) => NONE
  8511.  
  8512.     fun createBinary(indent, filename,
  8513.                    statModule: statModule,
  8514. --- 159,165 ----
  8515.         in
  8516.           SOME sec
  8517.         end
  8518. !         handle (SystemCall _) => NONE
  8519.  
  8520.     fun createBinary(indent, filename,
  8521.                    statModule: statModule,
  8522.  
  8523. <PATCH END>
  8524.  
  8525. Option 2:
  8526.  
  8527. Create a new exception SysIO wich the module SysIO raises on failure and trap
  8528. that. ( This is to my mind better since SystemCall is a rather wide exception
  8529. to be trapping ).
  8530.  
  8531. Status: fixed in 0.73
  8532. -------------------------------------------------------------------------------
  8533. 282. 'sharable' & 'pervshare' compilers produce different .bin
  8534. Submitter:      Richard O'Neill (cmp7130%sys.uea.ac.uk@nsfnet-relay.ac.uk)
  8535. Date:         Mon Jul 23 10:53:45 BST 1990
  8536. Version:        0.60
  8537. System:         Sun3/50, SunOS 4.1
  8538. Severity:       You decide...
  8539. Problem: 
  8540. Status: R
  8541.  
  8542. The '.bin' files produced by the normal and the '-pervshare' versions of the
  8543. compiler are different and each 'version' cannot load the other's '.bin' file
  8544. reliably.
  8545.  
  8546. Perhaps I have built the two versions differently, but I cannot see how since
  8547. they were both built at the same time with the same .mo files (compiled with
  8548. the 0.59 batch compiler).
  8549.  
  8550. Below is a comprehensive transcript which should help in reproducing the bug,
  8551. if it can be reproduced...
  8552.  
  8553. Transcript:
  8554.  
  8555. unix% cat > bug.sml
  8556. functor test () = struct val it = "testing, testing, 1, 2, 3..." end
  8557. unix% sml.pervshare
  8558. Standard ML of New Jersey, Version 0.60, 13 July 1990
  8559. val it = () : unit
  8560. - import "bug";
  8561. [reading bug.sml]
  8562. [writing bug.bin... done]
  8563. [closing bug.sml]
  8564. functor test
  8565. - ^D
  8566. unix% sml.sharable
  8567. Standard ML of New Jersey, Version 0.60, 13 July 1990
  8568. val it = () : unit
  8569. - import "bug";
  8570. [reading bug.bin... done]
  8571.  
  8572. [Major collection... 99% used (530424/535668), 1500 msec]
  8573.  
  8574. [Increasing heap to 6920k]
  8575.  
  8576. [Major collection... 100% used (530424/530424), 1400 msec]
  8577.  
  8578. [Increasing heap to 11160k]
  8579.  
  8580. [Major collection... 100% used (530424/530424), 1400 msec]
  8581.  
  8582. [Increasing heap to 17520k]
  8583.  
  8584. [Major collection... 100% used (530424/530424), 1400 msec]
  8585.  
  8586. [Increasing heap to 22288k]
  8587.  
  8588. [Major collection... 100% used (530424/530424), 1400 msec]
  8589.  
  8590. [Increasing heap to 22656k]
  8591.  
  8592. [Major collection... 100% used (530424/530424), 1420 msec]
  8593.  
  8594. [Increasing heap to 22744k]
  8595.  
  8596. [Major collection... 100% used (530424/530424), 1400 msec]
  8597.  
  8598. [Increasing heap to 22752k]
  8599.  
  8600. [Major collection... 100% used (530424/530424), 1400 msec]
  8601.  
  8602. Warning: can't increase heap
  8603.  
  8604. Ran out of memory
  8605. unix% mv bug.bin bug.bin.sharable
  8606. unix% sml.sharable
  8607. Standard ML of New Jersey, Version 0.60, 13 July 1990
  8608. val it = () : unit
  8609. - import "bug";
  8610. [reading bug.sml]
  8611. [writing bug.bin... done]
  8612. [closing bug.sml]
  8613. functor test
  8614. - ^D
  8615. unix% sml.pervshare
  8616. Standard ML of New Jersey, Version 0.60, 13 July 1990
  8617. val it = () : unit
  8618. - import "bug";
  8619. [reading bug.bin... done]
  8620. functor test
  8621. - structure Test=test ();
  8622. insttyc: NULLtyc
  8623. Error: Compiler bug: Functor.applyFunctor.insttyc
  8624. - ^D
  8625. unix% mv bug.bin bug.bin.pervshare
  8626. unix% cmp bug.bin.sharable bug.bin.pervshare
  8627. bug.bin.sharable bug.bin.pervshare differ: char 62, line 2
  8628. unix% ll bug.bin.*
  8629. -rw-------  1 cmp7130      1415 Jul 23 10:21 bug.bin.pervshare
  8630. -rw-------  1 cmp7130     17331 Jul 23 10:18 bug.bin.sharable
  8631.  
  8632. Status: Fixed (defunct feature)
  8633. -------------------------------------------------------------------------------
  8634. 283. openread (run.c) checking
  8635. Submitter: Peter Weinberger
  8636. Date: 8/17/90
  8637. Version: ?
  8638. Severity: minor
  8639. Problem:
  8640.     openread() in run.c does not check to see if it runs off the
  8641.     end of its allowed space.
  8642. Comments:
  8643.     in practice, this shouldn't be a problem, since openread() only reads
  8644.     the first two or three mo files, which should be smaller than the
  8645.     initial heap size.
  8646. Status: fixed in 0.74
  8647. -------------------------------------------------------------------------------
  8648. 284. Poor type specification handling in mutually recursive functions.
  8649. Submitter:      Richard O'Neill (rmo%sys.uea.ac.uk@nsfnet-relay.ac.uk)
  8650. Date:        Tue Aug 14 10:04:21 BST 1990
  8651. Version:        0.64, 0.62, 0.56, ...
  8652. System:         Sun3/180, SunOS 4.1
  8653. Problem:
  8654.  
  8655. When processing mutually recursive functions, Sml of NJ's current type
  8656. mechanism prefers its own inferred types of functions to those specifically
  8657. declared by the user.
  8658.  
  8659. Code:
  8660.     type 'a foobar = {foo:'a, bar:'a}
  8661.  
  8662.     fun Foo (acc : 'a list foobar)  (nil : 'a list) = acc
  8663.       | Foo {foo, bar} (h :: t) = Bar {foo=(h :: foo), bar=bar} t
  8664.  
  8665.     and Bar (acc : 'a list foobar)  (nil : 'a list) = acc
  8666.       | Bar {foo, bar} (h :: t) = Foo {foo=foo, bar=(h :: bar)} t
  8667.  
  8668. Transcript:
  8669. unix% sml
  8670. Standard ML of New Jersey, Version 0.64, 24 August 1990
  8671. val it = () : unit
  8672. - use "code.sml";
  8673. [opening code.sml]
  8674. type 'a  foobar = {bar:'a,foo:'a}
  8675. val Foo = fn : 'a list foobar -> 'a list -> 'a list foobar
  8676. val Bar = fn : {bar:'a list,foo:'a list} -> 'a list -> 'a list foobar
  8677. [closing code.sml]
  8678. -
  8679. - (* One would expect Foo & Bar to have the SAME type *)
  8680.  
  8681. Comments:
  8682.  
  8683. The type system seems to be deciding on the type of 'Bar' when it encounters
  8684. it in the definition of 'Foo', and then sticking to that. Whilst it checks to
  8685. see whether the type in the declaration of foo matches the type it has
  8686. inferred, it does not change the 'Foo's type to be in line with its 
  8687. declaration.
  8688.  
  8689. One can work around the problem by making sure that 'Bar' has the desired type
  8690. the first time it is encountered. Thus, if Foo is defined as :-
  8691.  
  8692.     fun Foo (acc : 'a list foobar)  (nil : 'a list) = acc
  8693.       | Foo {foo,bar} (h :: t) =
  8694.          Bar ({foo=(h :: foo), bar=bar} : 'a list foobar) t
  8695.  
  8696. the correct types result :-
  8697.     type 'a  foobar = {bar:'a,foo:'a}
  8698.     val Foo = fn : 'a list foobar -> 'a list -> 'a list foobar
  8699.     val Bar = fn : 'a list foobar -> 'a list -> 'a list foobar
  8700.  
  8701. My (ancient) version of Poly/ML also exhibits the same behaviour.
  8702.  
  8703. Status: not a bug; type abbreviations are not new types
  8704. -------------------------------------------------------------------------------
  8705. 285. Bus error
  8706. Submitter:
  8707.  Alain Deutsch, Laboratoire d'Informatique, LIX,
  8708.  Ecole Polytechnique, 91128 Palaiseau Cedex, France.
  8709.  
  8710. Date: 8-30-1990
  8711.  
  8712. Version:
  8713.  Standard ML of New Jersey, Version 0.56, 13 April 1990
  8714.  
  8715. System:
  8716.  ULTRIX V4.0 (Rev. 174) System #1: Sat Feb 10 01:14:11 MET 1990
  8717.  UWS V4.0 (Rev. 164)
  8718.  
  8719. Severity:
  8720.  critical
  8721.  
  8722. Problem:
  8723.  Bus error.
  8724.  
  8725. Code:
  8726.  use "bug.sml";
  8727.  (see enclosed files below, tarmail format)
  8728.  
  8729. Transcript:
  8730.  Standard ML of New Jersey, Version 0.56, 13 April 1990
  8731.  Warning: input and output are now uncurried, arithmetic exceptions
  8732.  are re-arranged, div and mod are different; see doc/NEWS
  8733.  val it = () : unit
  8734.  - [opening /usr/users/lix/icsla/deutsch/ModeleSemantique/Bug/bug.sml]
  8735.  [opening Extensions.sml]
  8736.  type 'a   printer = outstream * 'a -> unit
  8737.  type 'a   transformer = 'a -> 'a
  8738.  [closing Extensions.sml]
  8739.  val it = () : unit
  8740.  [opening Utilities.sig.sml]
  8741.  signature Utilities =
  8742.    sig
  8743.      val assoc : ''a * (''a * 'b) list -> 'b option
  8744.      val butlast : 'a list -> 'a list
  8745.      val cartesian_product : 'a list * 'b list -> ('a * 'b) list
  8746.      val display_list : string * string * string * 'a printer -> 'a list printer
  8747.      val display_pair : string * string * string * 'a printer * 'b printer -> ('a * 'b) printer
  8748.      val error : string * string -> 'a
  8749.      val is_prefix : ''a list * ''a list -> bool
  8750.      val makestring_list : string * string * string * ('a -> string) -> 'a list -> string
  8751.      val member : ''a * ''a list -> bool
  8752.      val replace_prefix : (''a list * ''a list) * ''a list -> ''a list
  8753.      val update_alist : ''a * 'b * (''a * 'b) list -> (''a * 'b) list
  8754.    end
  8755.  [closing Utilities.sig.sml]
  8756.  val it = () : unit
  8757.  [opening Strings.sig.sml]
  8758.  signature Strings =
  8759.    sig
  8760.      type T
  8761.      val < : T * T -> bool
  8762.      val Display : T printer
  8763.      val Hash : T -> int
  8764.      val MakeString : T -> string
  8765.      val New : string -> T
  8766.    end
  8767.  [closing Strings.sig.sml]
  8768.  val it = () : unit
  8769.  [opening Aliases.sig.sml]
  8770.  signature Aliases =
  8771.    sig
  8772.      type Aliases
  8773.      type Path
  8774.      datatype Accessor
  8775.        con IntAcc : int -> Accessor
  8776.        con NamedAcc : string -> Accessor
  8777.      val ++ : Path * Accessor -> Path
  8778.      val Add : Path * Path -> Aliases transformer
  8779.      val Adds : Path list * Path list -> Aliases transformer
  8780.      val Aliased : Path * Path -> Aliases -> bool
  8781.      val Aliases : Path * Aliases -> Path list
  8782.      val DisplayAccessor : Accessor printer
  8783.      val DisplayPath : Path printer
  8784.      val MakeStringAcc : Accessor -> string
  8785.      val MakeStringPath : Path -> string
  8786.      val NewPath : Accessor list -> Path
  8787.      val PathDrop : Path * int -> Path
  8788.      val PathLength : Path -> int
  8789.      val PathNth : Path * int -> Accessor
  8790.      val Remove : Path list -> Aliases transformer
  8791.      val SetVariable : Path * Path -> Aliases transformer
  8792.    end
  8793.  [closing Aliases.sig.sml]
  8794.  val it = () : unit
  8795.  [opening Object.sig.sml]
  8796.  signature Object =
  8797.    sig
  8798.      type T
  8799.      val Display : T printer
  8800.    end
  8801.  [closing Object.sig.sml]
  8802.  val it = () : unit
  8803.  [opening OrderedSet.sig.sml]
  8804.  signature OrderedSet =
  8805.    sig
  8806.      type T
  8807.      val < : T * T -> bool
  8808.      val Display : T printer
  8809.    end
  8810.  [closing OrderedSet.sig.sml]
  8811.  val it = () : unit
  8812.  [opening Map.sml]
  8813.  Map.sml:125.6-127.68 Warning: match not exhaustive
  8814.      tree ((key,_),_,empty,_) => ...
  8815.      tree ((key,_),_,nonempty_subtree,_) => ...
  8816.  pid 4566 (sml) was killed on unaligned access, at pc 0x6016e0
  8817.  
  8818.  Process SML bus error
  8819.  
  8820. Comments:
  8821.  The files loaded in "use.sml" are indeed necessary to reproduce the
  8822.  bug. Removing any one of them suppresses that particular occurence of
  8823.  the bug, bug, but only shifts the problem.
  8824.  
  8825. Fix:
  8826.  Perhaps the GC, as suggested by the vanishing nature of
  8827.  the bug.
  8828.  
  8829. Enclosed files: see bug285.tarmail
  8830. Status: probably fixed by 0.73
  8831. -------------------------------------------------------------------------------
  8832. 286. Compiler bug: inststr NULLstr
  8833. Submitter: Bob Harper (Robert.Harper@cs.cmu.edu)
  8834. Date: 9/6/90
  8835. Version: ?
  8836. Severity: minor
  8837. Problem:
  8838.   Compiler bug secondary error
  8839. Code:
  8840.     functor AbsSyn( structure Id : ID and UnOp : UNOP 
  8841.                                       and BinOp : BINOP ): ABSSYN =
  8842.      struct end;
  8843.     structure AbsSyn : ABSSYN = AbsSyn( structure Id = Id );
  8844.  
  8845.     (* because I forgot to add in the extra parameters *)
  8846.  
  8847. Transcript:
  8848.     The result on execution is:
  8849.  
  8850.     /tmp/sml.tmp.k01743:2.5-2.10 Error: unmatched structure spec: UnOp
  8851.     /tmp/sml.tmp.k01743:2.5-2.10 Error: unmatched structure spec: BinOp
  8852.     Error: Compiler bug: inststr NULLstr
  8853. Status: fixed in 0.70
  8854. -------------------------------------------------------------------------------
  8855. 287. cosine function incorrectly defined
  8856. Submitter:  Valerio Pinci
  8857. Date: SEPT 6, 1990
  8858. Version: 0.62
  8859. System: Sparc Station 1, SUN OS 0.43
  8860. Severity: major
  8861. Problem: cos function returns wrong values.
  8862. Code:
  8863.   cos 0.0;
  8864. Transcript:
  8865.   - cos 0.0;
  8866.   val it = 0.0 : real
  8867. Fix:
  8868.    In boot/math.sml, change "fun cos x = sin(PI-x)" to
  8869.    "fun cos x = sin(PIo2-x)".
  8870. Status: fixed in 0.66
  8871. -------------------------------------------------------------------------------
  8872. 288.  extraneous "match not exhaustive" warning
  8873. Submitter:      John (jhr@cs.cornell.edu)
  8874. Date:        9/8/90
  8875. Version:        0.64
  8876. System:         sun-4
  8877. Severity:       minor
  8878. Problem:        extraneous "match not exhaustive" warning
  8879. Code:
  8880. Transcript:     <transcript of session illustrating problem>
  8881.  
  8882.   Standard ML of New Jersey, Version 0.64, 24 August 1990
  8883.   val it = () : unit
  8884.   - fun f 0 = 0 | f i = 1;
  8885.   std_in:1.5-1.21 Warning: match not exhaustive
  8886.   val f = fn : int -> int
  8887.   - fun f 0 = 0 | f _ = 1;
  8888.   std_in:3.5-3.21 Warning: match not exhaustive
  8889.   val f = fn : int -> int
  8890.   - f 5;
  8891.   val it = 1 : int
  8892.  
  8893. Comments:
  8894.  
  8895. [Appel] I tried this on version 0.64 on our dec 5810, and it works fine
  8896. (no extraneous "match not exhaustive" messages).  Was yours a profiling
  8897. version or something like that?
  8898.  
  8899. I tried it on a sun-4 here (version 0.64) and the bug did not show up,
  8900. so it's not machine-specific.
  8901.  
  8902. Status: fixed in 0.69
  8903. -------------------------------------------------------------------------------
  8904. 289. 0.65 prerelease  core dumps
  8905. Submitter: Bob Ballance (ballance@cascade.cs.unm.edu
  8906. Date: 9/13/90
  8907. Version: 0.65
  8908. System: ?
  8909. Severity: critical
  8910. Problem:  core dump
  8911. Code:
  8912. >>>>>>>>>> Sample file --- Causes failure of 0.65. Running "agcd" after
  8913. failed load causes core dump.<<<<<<<<<
  8914. (*
  8915.  *    Stephen R. Wheat, 9/6/90
  8916.  *    CS550 - HW1
  8917.  *)
  8918.  
  8919. (*
  8920.  * Find the greatest common divisor
  8921.  *)
  8922. fun gcd(1,b) = 1    (* avoid an endless situation *)
  8923.     | gcd(a,1) = 1    (* avoid an endless situation *)
  8924.     | gcd(0,b) = b    (* most likely the one evenly divides the other *)
  8925.     | gcd(a,0) = a    (* most likely the one evenly divides the other *)
  8926.     | gcd(a,b) =
  8927.     if (a<b) then
  8928.         gcd(a,b mod a)
  8929.     else
  8930.         (* if they are equal, the next recursion will get the answer *)
  8931.         gcd(a mod b,b);
  8932.  
  8933. (*
  8934.  * My own absolute value function
  8935.  *)
  8936. fun abs(a) = if (a<0) then ~a else a;
  8937.  
  8938. (*
  8939.  * Find the gcd, regardless of the signs of the parameters
  8940.  *)
  8941. fun agcd(a,b) = gcd(abs(a),abs(b));
  8942.  
  8943. (*
  8944.  * Convert a rational number (represented as a 2-tuple) into its reduced form
  8945.  *)
  8946. fun reduce(a,b) = 
  8947.     let val c = agcd(a,b)
  8948.     in
  8949.     if (c = 1) then
  8950.         (* this avoids an endless recursion *)
  8951.         (a,b)
  8952.     else
  8953.         reduce((a div c),(b div c))
  8954.     end;
  8955. Status: fixed in 0.69
  8956. -------------------------------------------------------------------------------
  8957. 290. bin files of share/noshare versions are incompatible
  8958. Submitter: Eric Cooper (Eric.Cooper@cs.cmu.edu)
  8959. Date: 9/18/90
  8960. Version: 0.65
  8961. System: ?
  8962. Severity: minor
  8963. Problem:
  8964.     The one problem I still have is that sml-noshare gets an illegal
  8965.     instruction when it tries to import a .bin file written by the sharable
  8966.     sml, and vice versa.  Also, the .bin files produced by sml-noshare are
  8967.     much larger than those produced by sml. For example, compiling
  8968.     stream.sig.sml produces the following .bin files:
  8969.  
  8970.     -rw-r--r--  1 ecc         2664 Sep 18 13:04 obj/stream.sig.bin
  8971.     -rw-r--r--  1 ecc        14904 Sep 18 13:17 obj-noshare/stream.sig.bin
  8972. Code:
  8973.     (* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
  8974.  
  8975.     (* STREAM: signature for a lazy stream.*)
  8976.  
  8977.     signature STREAM =
  8978.      sig type 'xa stream
  8979.      val streamify : (unit -> '_a) -> '_a stream
  8980.      val cons : '_a * '_a stream -> '_a stream
  8981.      val get : '_a stream -> '_a * '_a stream
  8982.      end
  8983. Comments:  same as 282
  8984. Status: Fixed (defunct feature)
  8985. -------------------------------------------------------------------------------
  8986. 291. floating point on sparc
  8987. Submitter: Bernard Sufrin
  8988. Date: 9/18/90
  8989. Version: 0.56
  8990. System: Sparc
  8991. Problem:
  8992. The ``bad'' functions seem to compile incorrectly on Sparc machines
  8993. but ok on 68020 machines. Looks like >=0.0 is compiled wrongly, but the
  8994. circumstances are mystifying.  Why does the presence of the pair parameter seem
  8995. to be critical (offset calculation in the machine-specific code-generator?).
  8996.  
  8997. Code:
  8998.  
  8999. (* try ??bad(0.0, 0.0) (~0.2) *)
  9000.  
  9001.     fun  bad (x, y)  l =
  9002.        if l >= 0.0 then  x else bad(x+l, y) (~l);
  9003.     fun  alsobad (x, y)  l =
  9004.        if l>0.0  orelse  l=0.0 then  x else alsobad(x+l, y) (~l);
  9005.     fun  good (x, y)  l =
  9006.        if 0.0 <= l then  x else good(x+l, y) (~l);
  9007.     fun  alsogood x y  l =
  9008.        if l >= 0.0 then  x else alsogood(x+l) y (~l);
  9009.  
  9010. Status: fixed in 0.65
  9011. -------------------------------------------------------------------------------
  9012. 292. debugger and interpreter incompatible
  9013. Submitter:      Todd Knoblock
  9014.         Todd@eecs.umich.edu
  9015. Date:        24 September 1990
  9016.  
  9017. Version:        0.65
  9018. System:         Decstation 3100 under bsd AND Sun4/sparc under sunos
  9019. Severity:       Very Minor
  9020. Problem:        Compilation of sml with interpretor and debug packages fails
  9021.  
  9022. Transcript:     command: makeml -decstation bsd -i -debug
  9023.               or makeml -sun4 sunos -i -debug
  9024. appears to progress normally until
  9025.  
  9026.  
  9027. [closing dbguser/hio.sml]
  9028. val it = () : unit
  9029. [opening dbguser/hstore.sml]
  9030. [opening debug/weak.sml]
  9031. Error: Compiler bug: bad primop in interp
  9032. [closing debug/weak.sml]
  9033. [closing dbguser/hstore.sml]
  9034. [closing dbguser/userlevel.sml]
  9035.  
  9036.  
  9037. Comments:
  9038.  
  9039. Running the compilation without the -i works on both platforms.
  9040. If the interpretor and debugger are truly incompatible, then
  9041. makeml should flag it.
  9042. (apt) They aren't incompatible: the interpreter was broken.
  9043.  
  9044. Status: fixed as of 0.88, but interpreter breaks elsewhere on debugger code.
  9045. -------------------------------------------------------------------------------
  9046. 293. debug problems
  9047. Submitter:         Todd Knoblock, todd@eecs.umich.edu
  9048. Date:         26 September 1990
  9049. Version:    SML 0.65, emacs 18.55.1
  9050. System:        Decstation under ultrix and Sun sparc under sunos
  9051. Severity:    error message: minor, no output: critical
  9052.  
  9053. Synopsis:
  9054.  
  9055. I am having two problems with the emacs debug package.
  9056.  
  9057. The first is quite minor: on start-up on a non-x-display (like my
  9058. terminal at home), emacs reports the following error when loading
  9059. sml-init: file mode specification error:
  9060. (void-variable-x-button-m-left).
  9061.  
  9062. The second is more serious.  When sending to the sml process, I do not
  9063. get output until I move (c-x o/c-x b) into the process buffer.  For example, 
  9064. if I have this in a buffer
  9065.  
  9066. fun f(0) = 1
  9067.   | f(x) = x*(f (x-1));
  9068.  
  9069. and type c-c c-c, then if sml has not been run before, emacs
  9070. will bring up a window, and start it properly.  However, the
  9071. only output is 
  9072.  
  9073. Standard ML of New Jersey, Version 0.65, 10 September 1990
  9074. val it = () : unit
  9075. - emacsInit (); cd "/afs/engin.umich.edu/user/t/o/todd/";
  9076. [opening /tmp/sml.tmp.a02351]
  9077.  
  9078.  
  9079. Once I move into the buffer, then I get the rest of the output:
  9080.  
  9081.  
  9082. val f = fn : int -> int
  9083. [closing /tmp/sml.tmp.a02351]
  9084.  
  9085. If sml is already running, and the window is not visible, then
  9086. sending to the buffer does not cause it to become visible.
  9087.  
  9088. Comments:
  9089.  
  9090. If I disable the debugging code, by removing the two "hooks"
  9091. in sml-init, then the interface works as in the past.  I am
  9092. running emacs version 18.55.1, and have tried it on two platforms:
  9093. decstation under ultrix, and a sparc under sunos.  Finally, it 
  9094. appears that the file outdent.el is redundant now, and could be
  9095. removed from the distribution.
  9096.  
  9097. Comments: [apt, 2/1/93]
  9098. These bugs aren't fixed.
  9099. The first is just a trivial error message.
  9100. As to the second: we don't really guarantee that c-c c-c and similar
  9101. emacs interface tricks will work with the debugger.
  9102.  
  9103. You could "not a bug" these if you want, though they should get addressed
  9104. eventually -- I deliberately didn't spend time on minor emacs-related
  9105. problems last summer.
  9106.  
  9107. Status: open
  9108. -------------------------------------------------------------------------------
  9109. 294. weak polymorphic types
  9110. Submitter: David Berry
  9111. Date: 9/24/90
  9112. Version: 0.65
  9113. Severity: major
  9114. Problem:
  9115.   The Memo structure in the Library still doesn't compile under SML-NJ 0.65
  9116.   It compiles under Poly/ML, and is based on a version for Edinburgh ML.
  9117. Transcript:
  9118. - use "memo.sml";
  9119. [opening memo.sml]
  9120. [opening ../signatures/Memo.sml]
  9121. signature Memo =
  9122.   sig
  9123.     val memo : (Nat -> Nat) -> ('a -> Nat) -> (('a -> '_b) -> 'a -> '_b) -> ('a
  9124. -> '_b) * ('a -> '_b)
  9125.     val memo2 : (Nat -> Nat) -> ('a -> Nat) -> ('_b -> Nat) -> (('a -> '_b -> '_
  9126. c) -> 'a -> '_b -> '_c) -> ('a -> '_b -> '_c) * ('a -> '_b -> '_c)
  9127.     val memo3 : (Nat -> Nat) -> ('a -> Nat) -> ('_b -> Nat) -> ('_c -> Nat) -> (
  9128. ('a -> '_b -> '_c -> '_d) -> 'a -> '_b -> '_c -> '_d) -> ('a -> '_b -> '_c -> '_
  9129. d) * ('a -> '_b -> '_c -> '_d)
  9130.     val version : real
  9131.   end
  9132. [closing ../signatures/Memo.sml]
  9133. val it = () : unit
  9134. memo.sml:41.7-53.33 Error: nongeneric weak type variable
  9135.   memo : (Nat -> Nat) -> ('aU -> Nat) -> (('aU -> '~3Z) -> 'aU -> '~3Z) -> ('aU
  9136. -> '~3Z) * ('aU -> '~3Z)
  9137. memo.sml:41.7-53.33 Error: nongeneric weak type variable
  9138.   memo : (Nat -> Nat) -> ('aU -> Nat) -> (('aU -> '~3Z) -> 'aU -> '~3Z) -> ('aU
  9139. -> '~3Z) * ('aU -> '~3Z)
  9140. memo.sml:41.7-53.33 Error: nongeneric weak type variable
  9141.   memo : (Nat -> Nat) -> ('aU -> Nat) -> (('aU -> '~3Z) -> 'aU -> '~3Z) -> ('aU
  9142. -> '~3Z) * ('aU -> '~3Z)
  9143. memo.sml:41.7-53.33 Error: nongeneric weak type variable
  9144.   memo : (Nat -> Nat) -> ('aU -> Nat) -> (('aU -> '~3Z) -> 'aU -> '~3Z) -> ('aU
  9145. -> '~3Z) * ('aU -> '~3Z)
  9146. memo.sml:58.5-58.76 Error: operator and operand don't agree (circularity)
  9147.   operator domain: ('Z -> '~3Y) -> 'Z -> '~3Y
  9148.   operand:         ('Z -> '~3Y) -> 'Z -> '~3X -> '~3Y
  9149.   in expression:
  9150.     memo expfn injy ((fn _ => (fn <rule>)))
  9151. memo.sml:60.5-63.43 Error: nongeneric weak type variable
  9152.   memo3 : (Nat -> Nat) -> ('W -> Nat) -> ('Z -> Nat) -> ('~3X -> Nat) -> (('W ->
  9153.  '~3V) -> 'W -> 'Z -> '~3X -> '~3V) -> ('W -> '~3V) * ('W -> '~3V)
  9154. memo.sml:60.5-63.43 Error: nongeneric weak type variable
  9155.   memo3 : (Nat -> Nat) -> ('W -> Nat) -> ('Z -> Nat) -> ('~3X -> Nat) -> (('W ->
  9156.  '~3V) -> 'W -> 'Z -> '~3X -> '~3V) -> ('W -> '~3V) * ('W -> '~3V)
  9157. memo.sml:60.5-63.43 Error: nongeneric weak type variable
  9158.   memo3 : (Nat -> Nat) -> ('W -> Nat) -> ('Z -> Nat) -> ('~3X -> Nat) -> (('W ->
  9159.  '~3V) -> 'W -> 'Z -> '~3X -> '~3V) -> ('W -> '~3V) * ('W -> '~3V)
  9160. memo.sml:60.5-63.43 Error: nongeneric weak type variable
  9161.   memo3 : (Nat -> Nat) -> ('W -> Nat) -> ('Z -> Nat) -> ('~3X -> Nat) -> (('W ->
  9162.  '~3V) -> 'W -> 'Z -> '~3X -> '~3V) -> ('W -> '~3V) * ('W -> '~3V)
  9163. memo.sml:60.5-63.43 Error: nongeneric weak type variable
  9164.   memo3 : (Nat -> Nat) -> ('W -> Nat) -> ('Z -> Nat) -> ('~3X -> Nat) -> (('W ->
  9165.  '~3V) -> 'W -> 'Z -> '~3X -> '~3V) -> ('W -> '~3V) * ('W -> '~3V)
  9166. memo.sml:60.5-63.43 Error: nongeneric weak type variable
  9167.   memo3 : (Nat -> Nat) -> ('W -> Nat) -> ('Z -> Nat) -> ('~3X -> Nat) -> (('W ->
  9168.  '~3V) -> 'W -> 'Z -> '~3X -> '~3V) -> ('W -> '~3V) * ('W -> '~3V)
  9169. memo.sml:15.1-65.3 Error: value type in structure doesn't match signature spec
  9170.   name: memo
  9171.   spec:   (Nat -> Nat) -> ('a -> Nat) -> (('a -> '_b) -> 'a -> '_b) -> ('a -> '_
  9172. b) * ('a -> '_b)
  9173.   actual: (Nat -> Nat) -> ('a -> Nat) -> (('a -> '~3Z) -> 'a -> '~3Z) -> ('a ->
  9174. '~3Z) * ('a -> '~3Z)
  9175. memo.sml:15.1-65.3 Error: value type in structure doesn't match signature spec
  9176.   name: memo2
  9177.   spec:   (Nat -> Nat) -> ('a -> Nat) -> ('_b -> Nat) -> (('a -> '_b -> '_c) ->
  9178. 'a -> '_b -> '_c) -> ('a -> '_b -> '_c) * ('a -> '_b -> '_c)
  9179.   actual: (Nat -> Nat) -> ('a -> Nat) -> ('~3Z -> Nat) -> (('a -> '~3Y) -> 'a ->
  9180.  '~3Z -> '~3Y) -> error
  9181. memo.sml:15.1-65.3 Error: value type in structure doesn't match signature spec
  9182.   name: memo3
  9183.   spec:   (Nat -> Nat) -> ('a -> Nat) -> ('_b -> Nat) -> ('_c -> Nat) -> (('a ->
  9184.  '_b -> '_c -> '_d) -> 'a -> '_b -> '_c -> '_d) -> ('a -> '_b -> '_c -> '_d) * (
  9185. 'a -> '_b -> '_c -> '_d)
  9186.   actual: (Nat -> Nat) -> ('a -> Nat) -> ('b -> Nat) -> ('~3Z -> Nat) -> (('a ->
  9187.  '~3Y) -> 'a -> 'b -> '~3Z -> '~3Y) -> ('a -> '~3Y) * ('a -> '~3Y)
  9188. [closing memo.sml]
  9189. -
  9190. Comment: for Memo.sml to compile, the name of structure Array in Bytearray.sml
  9191. has to be changed.
  9192. Status: fixed in 0.74
  9193. -------------------------------------------------------------------------------
  9194. 295. Compiler bug: r_o in mcopt
  9195. Submitter: Kung Chen
  9196. Date: 9/30/90
  9197. Version: 0.56
  9198. System: Sparc, Sun OS
  9199. Problem: the optimization phase of pattern-mtaching dies
  9200. Code:
  9201. (* Categorical Abstract Machine simulator*)
  9202. (* D. Rabin, 5-aug-90, translated to SML by K. Chen, 10-sept-90*)
  9203.  
  9204. structure Cam = struct
  9205.  
  9206. (* CAM instructions*)
  9207.  
  9208. datatype 'val CAMinstr  = QuoteInstr  of 'val 
  9209.           | PrimInstr of int * string
  9210.           | AccInstr of int
  9211.           | ConsInstr
  9212.           | CdrInstr
  9213.           | CarInstr
  9214.           | PushInstr
  9215.           | SwapInstr
  9216.           | BranchInstr of 'val CAMinstr list * 'val CAMinstr list
  9217.           | CurInstr of 'val CAMinstr list
  9218.           | AppInstr
  9219.           | ReturnInstr
  9220.           | UpdInstr
  9221.           | IdInstr 
  9222.  
  9223. type  'val Code = 'val CAMinstr list
  9224.  
  9225. datatype 'const Val  = Simple of 'const
  9226.                | Close of 'const Val * 'const Val CAMinstr list
  9227.                | Pair of 'const Val * 'const Val 
  9228.                | Truth of bool
  9229.                | Save of 'const Val CAMinstr list
  9230.  
  9231. (* CAM state*)
  9232.  
  9233. datatype  'const CAMstate  = 
  9234.               CAMst of 'const Val * 'const Val list * (('const Val) CAMinstr) list 
  9235.              | Halt 
  9236.  
  9237. (* CAM state transition function*)
  9238.  
  9239. (* fun step : 'const CAMstate  -> 'const CAMstate *)
  9240.  
  9241. fun step CAMst(x, s, []) = Halt
  9242. |step CAMst(x, s, IdInstr::is) = CAMst(x, s, is)
  9243. |step CAMst(Pair(x, y), s, CarInstr::is) = CAMst(x ,s, is)
  9244. |step CAMst(Pair(x, y), s, CdrInstr::is) = CAMst(y, s, is)
  9245. |step CAMst(x, s , PushInstr::is) = CAMst(x, (x :: s), is)
  9246. |step CAMst(x, (y :: s), SwapInstr::is) = CAMst(y ,(x :: s), is)
  9247. |step CAMst(x, (y :: s), ConsInstr::is) = CAMst(Pair(x, y), (x :: s), is)
  9248. |step CAMst(x, s, CurInstr(code)::is) = CAMst(Close(x, code), s ,is)
  9249. |step CAMst(Pair(Close(x, code), y), s, AppInstr :: is)
  9250.   = CAMst(Pair(x, y), Save(is)::s, code)
  9251. |step CAMst(x, Save(code)::s, ReturnInstr::is) = CAMst(x, s, code)
  9252. |step CAMst(x, s, QuoteInstr(c)::is) = CAMst(c, s, is)
  9253. |step CAMst(Pair(x,Truth(true)), s, BranchInstr(ifTrue, ifFalse)::is)
  9254.   = CAMst(x, s, ifTrue)
  9255. |step CAMst(Pair(x, Truth(false)), s, BranchInstr(ifTrue, ifFalse)::is)  
  9256.   = CAMst(x, s, ifFalse)
  9257. |step CAMst(x, (y :: s), UpdInstr::is) = CAMst(y, s, is)
  9258.  
  9259. end
  9260.  
  9261. Transcript:
  9262. - use "cam.sml";
  9263. [opening cam.sml]
  9264. Error: Compiler bug: r_o in mcopt
  9265. [closing cam.sml]
  9266.  
  9267. Status: fixed in 0.69
  9268. -------------------------------------------------------------------------------
  9269. 296. patch for HP/MORE
  9270. Submitter:      Brian Boutel (brian@comp.vuw.ac.nz)
  9271. Date:           11 Oct 90
  9272. Version:        0.66
  9273. System:         m68020 (H-P workstation)  more/bsd
  9274. Severity:       
  9275. Problem:        source error in src/runtime/ml_os.h. Will not
  9276.         compile.
  9277. Code:           n/a
  9278. Transcript:     n/a
  9279. Comments:       I reported this for 0.56, the first version in which
  9280. my patches for more/bsd on H-P workstations were included. The line
  9281. in the source has been changed, but only to include the same fix for
  9282. NeXT machines.
  9283.  
  9284. Fix: src/runtime/ml_os.h. Add the underlined code:
  9285.  
  9286. /* where to find syscall.h, used for getting the #define SYS_open */
  9287. #if defined(VAX) || defined(NeXT) || defined(MORE)
  9288.                                   ~~~~~~~~~~~~~~~~
  9289. #include <syscall.h>
  9290. #else
  9291. #include <sys/syscall.h>
  9292. #endif
  9293.  
  9294. Status: fixed in 0.71
  9295. -------------------------------------------------------------------------------
  9296. 297. Bits.lshift on Sun4
  9297. Submitter:      Eric Cooper <ecc@cs.cmu.edu>
  9298. Date:          11 October 1990
  9299. Version:        Standard ML of New Jersey, Version 0.66, 15 September
  9300. 1990
  9301. System:         Sun4, both SunOS and Mach
  9302. Severity:       minor
  9303. Problem:
  9304.  
  9305. 1. Calls to Bits.lshift with constant arguments that should raise
  9306. Overflow cause a compiler error message instead.
  9307.  
  9308. 2. With non-constant arguments, Bits.lshift expressions that should
  9309. raise Overflow don't.
  9310.  
  9311. Code:
  9312.  
  9313. (1)    Bits.lshift(1,30);
  9314.  
  9315. (2)    fun lshift (x, y) = Bits.lshift (x, y);
  9316.     lshift (1, 30);
  9317.     lshift (1000000, 64);
  9318.  
  9319. Transcript:
  9320.  
  9321. Standard ML of New Jersey, Version 0.66, 15 September 1990
  9322. val it = () : unit
  9323. - fun lshift (x, y) = Bits.lshift (x, y);
  9324. val lshift = fn : int * int -> int
  9325. - lshift (1, 30);
  9326. val it = ~1073741824 : int    (* should raise Overflow *)
  9327. - lshift (1000000, 64);
  9328. val it = 1000000 : int    (* shifting by any multiple of 32 appears to be
  9329. equivalent to shifting by 0; should raise Overflow *)
  9330. - Bits.lshift (1, 30);
  9331. Error: Compiler bug: [SparcCM.ashr]
  9332. - ();
  9333. SIGILL code 0x2
  9334.  
  9335. Comments:
  9336.  
  9337. [Cooper] The number of bits to shift is evidently being reduced modulo 32.
  9338.  
  9339. [jhr] The lshift operation does not raise Overflow (Andrew's
  9340. decision).  I'll look at the other problem.
  9341.  
  9342. [jhr] When there is a compiler bug (at least in the backend), the
  9343. state of the system gets screwed up in such a way that the system core
  9344. dumps.  Is it possible to do a better job of cleaning up when a
  9345. compiler bug is detected?  An example is (on 0.66/sparc)
  9346.  
  9347.   - Bits.lshift (1, 30);
  9348.   Error: Compiler bug: [SparcCM.ashr]
  9349.   - ();
  9350.   SIGILL code 0x2
  9351.  
  9352. [appel]  I don't see where the Definition of Standard ML says that lshift
  9353. should raise Overflow!
  9354.  
  9355. Status: fixed in 0.66?
  9356. -------------------------------------------------------------------------------
  9357. 298. tags inconsistency
  9358. Submitter:      Allen Leung   allen@sbcs.sunysb.edu
  9359. Date:           12 Oct 1990
  9360. Version:        NJSML v0.66
  9361. System:         sun4
  9362. Severity:       very minor
  9363. Problem:        runtime tags of evaled and unevaled suspension has been
  9364.                 reversed
  9365. Comments:
  9366.       The runtime tags of evaluated and unevaluated suspension 
  9367. in System.Tags are inconsistent with the ones in tags.h
  9368.  
  9369. Status: ok in 0.70
  9370. -------------------------------------------------------------------------------
  9371. 299. user-bound tyvars
  9372. Submitter: John Reppy
  9373. Date: 
  9374. Version: 0.66
  9375. Severity: major
  9376. Problem:
  9377.    There are two versions of the first line of the sync function: one
  9378.    produces the error, the other works.
  9379. Transcript:
  9380.   Standard ML of New Jersey, Version 0.66, 15 September 1990
  9381.   val it = () : unit
  9382.   - use "compbug.sml";
  9383.   [opening compbug.sml]
  9384.   compbug.sml:8.3-57.5 Error: value type in structure doesn't match signature spec
  9385.     name: sync
  9386.     spec:   'a event -> 'a
  9387.     actual: 'a event -> 'aU
  9388.   [closing compbug.sml]
  9389.  
  9390. Code: compbug.sml
  9391. signature INTERNAL_CML =
  9392.   sig
  9393.     type 'a event
  9394.     val sync : 'a event -> 'a
  9395.   end
  9396.  
  9397. functor ConcurML () : INTERNAL_CML =
  9398.   struct
  9399.  
  9400.     exception Never and Escape
  9401.     exception Sync (* for signature compatability *)
  9402.  
  9403.     datatype evt_sts = EVT_ANY | EVT_READY | EVT_BLOCK
  9404.  
  9405.     type 'a base_evt = {
  9406.     pollfn : unit -> evt_sts,
  9407.     dofn : unit -> 'a,
  9408.     blockfn : bool ref -> 'a
  9409.       }
  9410.  
  9411.     datatype 'a event = EVT of 'a base_evt list
  9412.  
  9413.     local
  9414.       datatype 'a ready_evts
  9415.     = NO_EVTS                (* no ready events *)
  9416.     | ANY_EVTS of (int * (unit -> 'a) list)    (* list of ready anyevents *)
  9417.     | RDY_EVTS of (int * (unit -> 'a) list)    (* list of ready events *)
  9418.  
  9419.       fun extract _ = NO_EVTS
  9420.  
  9421.     (* Generate index numbers for "non-deterministic" selection.  We use a
  9422.      * round-robin style policy. *)
  9423.       val cnt = ref 0
  9424.       fun random i = let val j = !cnt in cnt := j+1; (j mod i) end
  9425.       fun selectEvt (_, [f]) = f()
  9426.     | selectEvt (n, l) = (nth(l, random n)) ()
  9427.     in
  9428.  
  9429.   (* sync : 'a event -> 'a *)
  9430.     fun sync (EVT []) = raise Never (** THIS DOESN'T WORK **)
  9431.     (* fun sync ((EVT []) : 'a event) = raise Never *)  (** THIS WORKS **)
  9432.       | sync (EVT el) = (
  9433.       case (extract el)
  9434.        of NO_EVTS => callcc (fn sync_k => let
  9435.         val evtflg = ref false
  9436.         fun log ({blockfn, ...} : 'a base_evt)=
  9437.               (throw sync_k (blockfn evtflg)) handle Escape => ()
  9438.         in
  9439.           app log el;
  9440.           (*atomicDispatch()*) raise Sync
  9441.         end)
  9442.         | ANY_EVTS anyevts => selectEvt anyevts
  9443.         | RDY_EVTS evts => selectEvt evts)
  9444.  
  9445.     end (* local *)
  9446.   end (* functor ConcurML *)
  9447.  
  9448. Status: not a bug? (check with MacQueen)
  9449. -------------------------------------------------------------------------------
  9450. 300. uncaught exceptin RegBind
  9451. Submitter: Soren Christensen,
  9452.            University of Aarhus, Computer Science Dep.,
  9453.            Denmark
  9454.            schristensen@daimi.dk
  9455. Date:      17 oct 90
  9456. Version:   0.65
  9457. System:    Sun4/280 / SunOS 4.0.1
  9458. Severity:  Critical
  9459. Problem:
  9460. Code:
  9461.  
  9462. (* filename: nb *)
  9463. datatype ''a ms =  !! of ( (int * ''a) * (''a ms) ) | empty;
  9464.  
  9465. fun cr (0,_) = empty
  9466.   | cr (coef,col) = (!!((coef,col),empty));
  9467.  
  9468. fun foo (c:int ms ref) =
  9469.  true
  9470. andalso (1 =  length [1])
  9471. andalso (cr (1,1) = (!c))
  9472. andalso (empty =  (!c));
  9473.  
  9474. Transcript:
  9475.  
  9476. Standard ML of New Jersey, Version 0.66, 15 September 1990
  9477. val it = () : unit
  9478. - use "nb";
  9479. [opening nb]
  9480. datatype 'a  ms
  9481. con !! : (int * 'a) * 'a ms -> 'a ms
  9482. con empty : 'a ms
  9483. val cr = fn : int * 'a -> 'a ms
  9484. [closing nb]
  9485.  
  9486. uncaught exception Regbind
  9487. - val x = 5;
  9488. Illegal instruction
  9489.  
  9490. Status: fixed in 0.69
  9491. -------------------------------------------------------------------------------
  9492. 301. Compiler bug: tycPath
  9493. Submitter: Andrew Appel
  9494. Date: 10/24/90
  9495. Version: 0.66
  9496. Severity: minor
  9497. Problem:
  9498.   The following program gets   Error: Compiler bug: tycPath
  9499.   after all the syntax errors.  Perhaps it should be a CASCADE.
  9500. Code:
  9501.     struct VMat :
  9502.     sig
  9503.     type v4 = real*real*real*real
  9504.     type m4 = v4*v4*v4*v4
  9505.     val vmul = v4*v4 -> v4
  9506.     val vdot = v4*v4 -> real
  9507.     val vmmul = v4*m4 -> v4
  9508.     val mmul = m4*m4 -> m4
  9509.     end =
  9510.     struct
  9511.  
  9512.     fun vmul((v1x, v1y, v1z, v1w), (v2x, v2y, v2z, v2w)) =
  9513.     (v1x * v2x, v1y * v2y, v1z * v2z, v1w * v2w)
  9514.  
  9515.     fun vdot((v1x, v1y, v1z, v1w), (v2x, v2y, v2z, v2w)) =
  9516.     v1x * v2x + v1y * v2y + v1z * v2z + v1w * v2w
  9517.  
  9518.     fun vmmul(v, (a, b, c, d)) =
  9519.     (vdot(v, a), vdot(v, b), vdot(v, c), vdot(v, d))
  9520.  
  9521.     fun mmul((a, b, c, d), m) =
  9522.     (vmmul(a, m), vmmul(b, m), vmmul(c, m), vmmul(d, m))
  9523.  
  9524.     end
  9525.  
  9526. Status: fixed in 0.71
  9527. -------------------------------------------------------------------------------
  9528. 302. match not exhaustive warnings from import have wrong location
  9529. Submitter:      Peter Canning <canning@hplabs.hp.com>
  9530. Date:        24 October 1990
  9531. Version:        0.66
  9532. System:         68020  HP-UX 7.0
  9533. Severity:       major
  9534. Problem:        match not exhaustive warnings from import have wrong location
  9535. Code:           
  9536. functor foo() =
  9537.   struct
  9538.     datatype T  = I of int
  9539.                 | B of bool
  9540.                 | S of string
  9541.  
  9542.     fun foo(I i) = i
  9543.       | foo(B b) = if b then 1 else 0
  9544.   end;
  9545. Transcript:     
  9546. Standard ML of New Jersey, Version 0.66, 15 September 1990
  9547. val it = () : unit
  9548. - import "foo";
  9549. [reading foo.sml]
  9550. foo.sml:0.0-0.0 Warning: match not exhaustive
  9551.         I i => ...
  9552.         B b => ...
  9553. [writing foo.bin... done]
  9554. [closing foo.sml]
  9555. functor foo
  9556. Comments:
  9557. The warning message should give line.column different from 0.0-0.0
  9558.  
  9559. Status: Fixed (defunct feature)
  9560. -------------------------------------------------------------------------------
  9561. 303. bad error reporting
  9562. Submitter:      Nick
  9563. Date:        25 Oct 90
  9564. Version:        0.66
  9565. System:         irrelevant
  9566. Severity:       minor
  9567. Problem:        junk error reporting
  9568.  
  9569. Code:
  9570.  
  9571.     foobar + 3;
  9572.  
  9573. Transcript:
  9574.  
  9575.  
  9576. (OK:)    Comments:std_in:1.1-1.6 Error: unbound variable foobar
  9577. (bogus:)std_in:1.1-1.10 Error: operator and operand don't agree (type mismatch)
  9578.       operator domain: undef * undef
  9579.       operand:         undef * int
  9580.       in expression:
  9581.         + (foobar,3)
  9582. (bogus:)std_in:1.8 Error: overloaded variable "+" not defined at type:
  9583.        undef
  9584.  
  9585. Status: fixed in 0.73
  9586. -------------------------------------------------------------------------------
  9587. 304. SIGEMT on sparc
  9588. Submitter: Nick Rothwell
  9589. Date: 10/25/90
  9590. Version: 0.66
  9591. System: sparc
  9592. Severity: major
  9593. Problem:
  9594.   0.66 has a SIGEMT problem on SPARC's, on hitting ^C (sometimes). Will
  9595.   try and narrow down if I can.
  9596.  
  9597.  Also from Mike Crawley <mjc@abstract-hardware-ltd.co.uk>, in 0.73:
  9598.   I have been able to repeat the following
  9599.   bug a number of times. Pressing ^C to interrupt
  9600.   sml while it is busy can sometimes crash it.
  9601.   The saved image I was using was 10MB at the time.
  9602.  
  9603.   ^C
  9604.   SIGEMT not related to gc (bogus test: 0x9de3bfc0 @ 0x9dd8)
  9605.  
  9606.   Mike Crawley.
  9607.   Abstract Hardware Ltd.
  9608.  
  9609. Status: fixed in 0.73
  9610. -------------------------------------------------------------------------------
  9611. 305. Strange floating point error
  9612. Submitter:       tmb@ai.mit.edu (Thomas M. Breuel)
  9613. Date: 11/28/90
  9614. Version:         0.66
  9615. System:          Sun4/SunOS4.1
  9616. Problem:         division by zero causes "strange floating point error" 
  9617. Code:            0.0/0.0
  9618. Transcript:     
  9619.  
  9620. Standard ML of New Jersey, Version 0.66, 15 September 1990
  9621. val it = () : unit
  9622. - 0.0/0.0;
  9623. strange floating point error
  9624. Process Inferior sml exited abnormally with code 3
  9625.  
  9626. Comments:
  9627.  
  9628. Other division-by-zero errors for floating point numbers raise Div.
  9629.  
  9630. Status: fixed in 0.69
  9631. -------------------------------------------------------------------------------
  9632. 306. list printing, printlength
  9633. Submitter:      tmb@ai.mit.edu
  9634. Date:        10/28/90
  9635. Version:        SML of NJ 0.66
  9636. System:         Sun 4/SunOS 4.0
  9637. Severity:       minor
  9638. Problem:        extraneous "dots" printed
  9639. Code:           [1,2,3,4,5,6,7,8,9,10,11,12];
  9640. Transcript:
  9641.  
  9642. - [1,2,3,4,5,6,7,8,9,10,11,12,13];
  9643. val it = [1,2,3,4,5,6,7,8,9,10,11,12,...] : int list
  9644. - [1,2,3,4,5,6,7,8,9,10,11,12];
  9645. val it = [1,2,3,4,5,6,7,8,9,10,11,12,...] : int list
  9646.  
  9647. Comments:
  9648.  
  9649. Since there are no unprinted elements in the 12 element
  9650. list, there should be no ellipsis either.
  9651.  
  9652. Status: fixed in 0.74
  9653. ----------------------------------------------------------------------------
  9654. 307. signature matching in 0.69
  9655. Submitter:      Greg Morrisett  jgmorris@cs.cmu.edu
  9656. Date:           April 29, 1991
  9657. Version:        0.67 and 0.69
  9658. System:         DECstation 3100, Mach and Sun-3 Mach
  9659. Severity:       critical?
  9660. Problem:        nested structures and signature matching
  9661. Code:           
  9662.  
  9663. signature SIG1 =
  9664.   sig
  9665.     structure T :
  9666.       sig
  9667.           type t
  9668.       end
  9669.     structure U :
  9670.       sig
  9671.           structure V :
  9672.               sig
  9673.                 val s : T.t
  9674.               end
  9675.       end
  9676.   end
  9677.  
  9678. structure S : SIG1 =
  9679.   struct
  9680.       structure T =
  9681.           struct
  9682.               datatype t = FOO
  9683.           end
  9684.       structure U =
  9685.           struct
  9686.               structure V =
  9687.                   struct
  9688.                       val s = T.FOO
  9689.                   end
  9690.           end
  9691.   end
  9692.  
  9693. Transcript:
  9694.  
  9695. Standard ML of New Jersey, Version 0.69, 3 April 1991
  9696. val it = () : unit
  9697. - use "bug.sml";
  9698. [opening bug.sml]
  9699. $$ lookTycPath 1: 0 0
  9700. tyconInContext: [0,0]
  9701. [closing bug.sml]
  9702.  
  9703. uncaught exception Subscript
  9704. -
  9705.  
  9706. Comments: I reduced this down to as small a problem as I could.  For instance,
  9707. removing any of the enclosing structures makes the bug go away.  This works
  9708. under version 0.64 and 0.65.  This came up in some "real" code and there is
  9709. no easy work-around...
  9710.  
  9711. Fix: ???
  9712.  
  9713. Status: fixed in 0.73
  9714. ---------------------------------------------------------------------------
  9715. 308. Mips RC6280 code generation bug
  9716. Submitter:      Toshinori Maeno <tmaeno@cc.titech.ac.jp>
  9717.         Computer Center,
  9718.         Tokyo Institute of Technology
  9719. Date:        1991-06-01
  9720. Version:        0.66 <SML of NJ version number>
  9721. System:         MIPS RC6280, 128MB; Riscos 4.52
  9722. Severity:       critical (at least for us :-)
  9723. Problem:        makeml dumps core after successful make of runtime/run
  9724. Code:
  9725.         makeml -mips riscos
  9726. Transcript:     
  9727. makeml> (cd runtime; make clean)
  9728.     rm -f *.o lint.out prim.s linkdata allmo.s run
  9729. makeml> rm -f mo
  9730. makeml> ln -s ../mo.mipsb mo
  9731. makeml> (cd runtime; rm -f run allmo.o allmo.s)
  9732. makeml> (cd runtime; make MACHINE=MIPS 'CFL= -systype bsd43' 'DEFS= -DRISCos -DRUNTIME=\"runtime\"' linkdata)
  9733.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -DRUNTIME=\"runtime\" -o linkdata linkdata.c
  9734. makeml> runtime/linkdata [runtime/IntMipsBig.mos]
  9735. runtime/linkdata> as runtime/allmo.s -o runtime/allmo.o
  9736. makeml> (cd runtime; make MACHINE=MIPS 'DEFS= -DRISCos' 'CPP=/lib/cpp -P' 'CFL= -systype bsd43' 'AS=as')
  9737.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c run.c
  9738.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c run_ml.c
  9739.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c callgc.c
  9740.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c gc.c
  9741.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c MIPS.dep.c
  9742.     /lib/cpp -P -DASM -DMIPS -DRISCos MIPS.prim.s > prim.s
  9743.     as -o prim.o prim.s
  9744.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c export.c
  9745.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c timers.c
  9746.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c ml_objects.c
  9747.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c cfuns.c
  9748.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c cstruct.c
  9749.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c signal.c
  9750.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c exncode.c
  9751.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -c malloc.c
  9752.     cc -g -signed -systype bsd43 -DMIPS -DRISCos -o run run.o run_ml.o callgc.o gc.o MIPS.dep.o prim.o export.o timers.o  ml_objects.o cfuns.o cstruct.o signal.o exncode.o malloc.o  allmo.o
  9753. makeml> echo ( exportML "sml"; output(std_out,System.version); output(std_out,(chr 10)); output(std_out, "")); | runtime/run -m 4096 -r 20 -h 2048 IntMipsBig
  9754.  
  9755. [Increasing heap to 2049k]
  9756. [Loading mo/CoreFunc.mo]
  9757. [Executing mo/CoreFunc.mo]
  9758. [Loading mo/Math.mo]
  9759. [Executing mo/Math.mo]
  9760. [Loading mo/Initial.mo]
  9761. [Executing mo/Initial.mo]
  9762. makeml: 18680 Illegal instruction - core dumped
  9763.          ^
  9764.     This number may be different for another run.
  9765.  
  9766. Comments:    On MIPS RC3240, makeml successfully made sml.
  9767.         runtime/run made on RC6280 works on RC3240 without problem.
  9768.         runtime/run made on either system dumps core on RC6280.
  9769.         0.68 reproduced the same problem.
  9770.         I disabled FlushIcache, but could not get improvement.
  9771.         I shall report this to MIPS, too.
  9772. [jgm] 
  9773. I assume this is the problem of using the branch delay slots for
  9774. some non-standard reason?
  9775.  
  9776. Status: Fixed in 0.70; other RC6280 problems not quite fixed in 0.71.
  9777. ---------------------------------------------------------------------------
  9778. 309: NeXTstation exported image doesn't work
  9779. Submitter: oneill@cs.sfu.ca
  9780. Date: 28 Mar 91
  9781. Version: 0.68
  9782. System: NeXTstation
  9783. Severity: 
  9784. Problem: boots and exports, but exported image bombs with SEGV when invoked
  9785. Fix:
  9786. Heres the changes I made to get as far as I got, (note, TRAP #2 on a 
  9787. NeXT flushes the 68040 code cache, which is necessary after a gc).
  9788.  
  9789.     Richard,
  9790.  
  9791.     (used to be {cmp7130,rmo}@sys.uea.ac.uk)
  9792.  
  9793. my diffs (w.r.t 0.68)...
  9794.  
  9795. diff -r -c runtime.orig/callgc.c runtime/callgc.c
  9796. *** runtime.orig/callgc.c    Wed Mar  6 11:50:57 1991
  9797. --- runtime/callgc.c    Thu Mar 21 15:19:19 1991
  9798. ***************
  9799. *** 86,95 ****
  9800. --- 86,103 ----
  9801.       int        live_size = old_high - arenabase;
  9802.       int        a = 0;
  9803.       ML_val_t    x = gcmessages;
  9804. + #ifdef NeXT
  9805. +     extern void * get_edata();
  9806. + #else
  9807.       extern int    edata;
  9808. + #endif
  9809.   
  9810.       resettimers();
  9811. + #ifdef NeXT
  9812. +     lastbreak = (int)get_edata();
  9813. + #else
  9814.       lastbreak = (int)&edata;
  9815. + #endif
  9816.       gcmessages = INT_CtoML(0);
  9817.       new_size = compute_new_size(live_size);
  9818.       do {
  9819. ***************
  9820. *** 330,335 ****
  9821. --- 338,346 ----
  9822.       arend = arenabase+arenasize;
  9823.       arstart = (((arend+old_high)/2)+3)&(~3);
  9824.       (*arptr) = arstart;
  9825. + #ifdef NeXT
  9826. +     asm("trap #2");
  9827. + #endif
  9828.   
  9829.   } /* end of callgc */
  9830.   
  9831. diff -r -c runtime.orig/export.c runtime/export.c
  9832. *** runtime.orig/export.c    Wed Nov 21 11:34:06 1990
  9833. --- runtime/export.c    Thu Mar 21 15:08:53 1991
  9834. ***************
  9835. *** 87,93 ****
  9836. --- 87,97 ----
  9837.    *  > set a_entry as address of start procedure
  9838.    */
  9839.   
  9840. + #ifdef NeXT
  9841. +     extern void * get_etext();
  9842. + #else
  9843.   extern int etext;   /* &etext is just beyond the end of the text segment */
  9844. + #endif
  9845.   extern int old_high;
  9846.   
  9847.   static int textstart,datastart;
  9848. ***************
  9849. *** 425,432 ****
  9850.   int datasize, bsssize;
  9851.   
  9852.   E.magic = MH_MAGIC;
  9853. ! E.cputype = CPU_TYPE_MC68030;
  9854. ! E.cpusubtype = CPU_SUBTYPE_NeXT;
  9855.   E.filetype = MH_EXECUTE;
  9856.   E.ncmds = 3;
  9857.   E.sizeofcmds = sizeof(tcmd) + sizeof(tsectn)
  9858. --- 429,436 ----
  9859.   int datasize, bsssize;
  9860.   
  9861.   E.magic = MH_MAGIC;
  9862. ! E.cputype = CPU_TYPE_MC680x0;
  9863. ! E.cpusubtype = CPU_SUBTYPE_MC68040;
  9864.   E.filetype = MH_EXECUTE;
  9865.   E.ncmds = 3;
  9866.   E.sizeofcmds = sizeof(tcmd) + sizeof(tsectn)
  9867. ***************
  9868. *** 442,448 ****
  9869.   tcmd.cmdsize = sizeof(tcmd) + sizeof(tsectn);
  9870.   strcpy(tcmd.segname,SEG_TEXT);
  9871.   tcmd.vmaddr = textstart;
  9872. ! tcmd.vmsize = (int) CEIL(((int)&etext),getpagesize())-textstart;
  9873.   tcmd.fileoff = 0;
  9874.   tcmd.filesize = tcmd.vmsize;
  9875.   tcmd.maxprot = VM_PROT_ALL;
  9876. --- 446,452 ----
  9877.   tcmd.cmdsize = sizeof(tcmd) + sizeof(tsectn);
  9878.   strcpy(tcmd.segname,SEG_TEXT);
  9879.   tcmd.vmaddr = textstart;
  9880. ! tcmd.vmsize = (int) CEIL(((int)get_etext()),getpagesize())-textstart;
  9881.   tcmd.fileoff = 0;
  9882.   tcmd.filesize = tcmd.vmsize;
  9883.   tcmd.maxprot = VM_PROT_ALL;
  9884.  
  9885.  
  9886. >From cs.cornell.edu!jhr Fri Mar 29 10:46:22 0500 1991
  9887. Received: by coma; Fri Mar 29 10:46:27 EST 1991
  9888. Received: by inet.att.com; Fri Mar 29 10:46 EST 1991
  9889. Received: from MAUI.CS.CORNELL.EDU by cloyd.cs.cornell.edu (5.65/I-1.98N)
  9890.     id AA21402; Fri, 29 Mar 91 10:46:22 -0500
  9891. Date: Fri, 29 Mar 91 10:46:22 -0500
  9892. From: jhr@cs.cornell.edu (John Reppy)
  9893. Message-Id: <9103291546.AA27105@maui.cs.cornell.edu>
  9894. Received: by maui.cs.cornell.edu (5.65/N-0.12)
  9895.     id AA27105; Fri, 29 Mar 91 10:46:20 -0500
  9896. To: appel@princeton.edu, dbm@research.att.com
  9897. Subject: Re:  NeXT 68040 attempt
  9898. Status: R
  9899.  
  9900. I have integrated Richard O'Neill's changes into my 0.68, in a style that is
  9901. more consistant with the runtime system.  Here are the diffs; maybe they can
  9902. be included in 0.69.  (BTW, there are probably still some other changes needed
  9903. to make this work).
  9904.   - John
  9905.  
  9906.  
  9907. <jhr@maui:97> diff -c ml_os.h ml_os.h.ORIG
  9908. *** ml_os.h     Fri Mar 29 10:40:07 1991
  9909. --- ml_os.h.ORIG        Wed Nov 21 14:34:31 1990
  9910. ***************
  9911. *** 111,122 ****
  9912.           (syscall(SYS_sysmips, MIPS_CACHEFLUSH, (addr), (size), ICACHE, 0))
  9913.   #  endif
  9914.   #else
  9915. ! #ifdef NeXT
  9916. ! #  define FlushICache(addr, size)     asm ("trap #2")
  9917. ! #else
  9918. ! #  define FlushICache(addr, size)
  9919.   #endif
  9920. - #endif
  9921.   
  9922.   #if defined(MACH) && defined(MIPS)
  9923.   
  9924. --- 111,118 ----
  9925.           (syscall(SYS_sysmips, MIPS_CACHEFLUSH, (addr), (size), ICACHE, 0))
  9926.   #  endif
  9927.   #else
  9928. ! #define FlushICache(addr, size)
  9929.   #endif
  9930.   
  9931.   #if defined(MACH) && defined(MIPS)
  9932.   
  9933. ***************
  9934. *** 158,163 ****
  9935. --- 154,160 ----
  9936.   #define READDIR(fd,buf,sz)    getdirentries((fd), (buf), (sz), &dummy)
  9937.   #endif
  9938.   
  9939.   #if defined(BSD) || defined(RISCos) || defined(HPUX) || defined(SGI)
  9940.   #define HAS_WRITEV
  9941.   #include <sys/uio.h>
  9942. ***************
  9943. *** 164,175 ****
  9944.   #define HAS_NONBLOCKING_IO
  9945.   #endif
  9946.   
  9947. ! #ifdef NeXT
  9948. ! extern void *get_edata();
  9949. ! # define EDATA                ((int)get_edata())
  9950. ! #else
  9951. ! extern int edata;
  9952. ! # define EDATA                ((int)(&edata))
  9953. ! #endif
  9954.   
  9955.   #endif !_ML_OS_
  9956. --- 161,167 ----
  9957.   #define HAS_NONBLOCKING_IO
  9958.   #endif
  9959.   
  9960.   
  9961.   #endif !_ML_OS_
  9962.  
  9963.  
  9964.  
  9965. <jhr@maui:98> diff -c callgc.c callgc.c.ORIG
  9966. *** callgc.c    Fri Mar 29 10:41:06 1991
  9967. --- callgc.c.ORIG       Wed Mar  6 14:50:57 1991
  9968. ***************
  9969. *** 86,94 ****
  9970.       int               live_size = old_high - arenabase;
  9971.       int               a = 0;
  9972.       ML_val_t  x = gcmessages;
  9973.   
  9974.       resettimers();
  9975. !     lastbreak = EDATA;
  9976.       gcmessages = INT_CtoML(0);
  9977.       new_size = compute_new_size(live_size);
  9978.       do {
  9979. --- 86,95 ----
  9980.       int               live_size = old_high - arenabase;
  9981.       int               a = 0;
  9982.       ML_val_t  x = gcmessages;
  9983. +     extern int        edata;
  9984.   
  9985.       resettimers();
  9986. !     lastbreak = (int)&edata;
  9987.       gcmessages = INT_CtoML(0);
  9988.       new_size = compute_new_size(live_size);
  9989.       do {
  9990.  
  9991. >From cs.sfu.ca!oneill Wed Apr 24 18:22:39 EDT 1991
  9992. Received: by coma; Wed Apr 24 18:22:39 EDT 1991
  9993. Received: by inet.att.com; Wed Apr 24 18:22 EDT 1991
  9994. Received: by relay.CDNnet.CA (4.1/1.14)
  9995.     id AA23566; Wed, 24 Apr 91 15:20:58 PDT
  9996. From: <oneill@cs.sfu.ca>
  9997. Date: 24 Apr 91 15:13 -0700
  9998. To: dbm@research.att.com
  9999. Cc: jhr@cs.cornell.edu
  10000. Message-Id: <9104242213.AA15593@phoenix.cs.sfu.ca>
  10001. Subject: Re: Getting Sml up and running on a NeXT running OS2.[01]
  10002. Status: R
  10003.  
  10004. Long long ago, you (dbm) wrote:
  10005. > I think we should have SML of NJ running on the 68040 NeXTs soon,
  10006. > since John Reppy has just bought one of them (to write his thesis
  10007. > on).  He is confident he can get SML running on it quite quickly.
  10008. > I'll forward your message to him, since it looks like a useful start
  10009. > on the problem.
  10010.  
  10011. John Reppy also wrote:
  10012. > It may be a while before I can fix this, since I still need to get a decent
  10013. > sized disk.
  10014.  
  10015. Well, after a month of messing about with other things, I finally got arround
  10016. to getting sml working the NeXT (my NeXT arrived and so I could work on it at
  10017. home). I'll tell you the problem and give my diffs. 
  10018.  
  10019. The problem was that, among the various load commands needed in the
  10020. executable's header, one is needed to load the c shared library, and this was
  10021. ommited (since previously programs weren't *forced* into using the shared
  10022. libraries).  Since the load command is always exactly the same, I did a
  10023. ghastly hack and substituted the thing in as a constant (array stuffed with
  10024. the right hex numbers). This isn't quite the cleanest thing to do, but I was
  10025. only concerned with getting it to work for me. (Yeah, I know, I'm lazy...)
  10026.  
  10027. Anyway, diffs follow, and it at least it works now...
  10028.  
  10029.     Richard,
  10030.  
  10031. ---8<--cut-here--(and ruin your monitor)--cut-here--8<---
  10032.  
  10033. *** export.c.orig       Wed Nov 21 11:34:06 1990
  10034. --- export.c    Wed Apr 10 17:06:57 1991
  10035. ***************
  10036. *** 87,93 ****
  10037. --- 87,98 ----
  10038.    *  > set a_entry as address of start procedure
  10039.    */
  10040.   
  10041. + #ifndef NeXT
  10042.   extern int etext;   /* &etext is just beyond the end of the text segment */
  10043. + #else
  10044. + extern void *get_etext();
  10045. + #endif
  10046.   extern int old_high;
  10047.   
  10048.   static int textstart,datastart;
  10049. ***************
  10050. *** 422,436 ****
  10051.   static unsigned long thcount;
  10052.   static struct NeXT_thread_state_regs ntregs;
  10053.   static unsigned int hdrsize;
  10054.   int datasize, bsssize;
  10055.   
  10056.   E.magic = MH_MAGIC;
  10057. ! E.cputype = CPU_TYPE_MC68030;
  10058. ! E.cpusubtype = CPU_SUBTYPE_NeXT;
  10059.   E.filetype = MH_EXECUTE;
  10060. ! E.ncmds = 3;
  10061.   E.sizeofcmds = sizeof(tcmd) + sizeof(tsectn)
  10062. !       + sizeof(dcmd) + sizeof(dsectn) + sizeof(bsectn)
  10063.         + sizeof(uthr) + sizeof(thflavor) + sizeof(thcount) + sizeof(ntregs);
  10064.   E.flags = MH_NOUNDEFS;
  10065.   
  10066. --- 427,445 ----
  10067.   static unsigned long thcount;
  10068.   static struct NeXT_thread_state_regs ntregs;
  10069.   static unsigned int hdrsize;
  10070. + static unsigned int lcmd[] = {0x00000006, 0x00000030, 0x00000014, 0x0000002c,
  10071. +                     0x05000000, 0x2f757372, 0x2f73686c, 0x69622f6c,
  10072. +                     0x69627379, 0x735f732e, 0x422e7368, 0x6c696200};
  10073.   int datasize, bsssize;
  10074.   
  10075.   E.magic = MH_MAGIC;
  10076. ! E.cputype = CPU_TYPE_MC680x0;
  10077. ! E.cpusubtype = CPU_SUBTYPE_MC68040;
  10078.   E.filetype = MH_EXECUTE;
  10079. ! E.ncmds = 4;
  10080.   E.sizeofcmds = sizeof(tcmd) + sizeof(tsectn)
  10081. !       + sizeof(dcmd) + sizeof(dsectn) + sizeof(bsectn) + sizeof(lcmd)
  10082.         + sizeof(uthr) + sizeof(thflavor) + sizeof(thcount) + sizeof(ntregs);
  10083.   E.flags = MH_NOUNDEFS;
  10084.   
  10085. ***************
  10086. *** 442,448 ****
  10087.   tcmd.cmdsize = sizeof(tcmd) + sizeof(tsectn);
  10088.   strcpy(tcmd.segname,SEG_TEXT);
  10089.   tcmd.vmaddr = textstart;
  10090. ! tcmd.vmsize = (int) CEIL(((int)&etext),getpagesize())-textstart;
  10091.   tcmd.fileoff = 0;
  10092.   tcmd.filesize = tcmd.vmsize;
  10093.   tcmd.maxprot = VM_PROT_ALL;
  10094. --- 451,457 ----
  10095.   tcmd.cmdsize = sizeof(tcmd) + sizeof(tsectn);
  10096.   strcpy(tcmd.segname,SEG_TEXT);
  10097.   tcmd.vmaddr = textstart;
  10098. ! tcmd.vmsize = (int) CEIL(((int)get_etext()),getpagesize())-textstart;
  10099.   tcmd.fileoff = 0;
  10100.   tcmd.filesize = tcmd.vmsize;
  10101.   tcmd.maxprot = VM_PROT_ALL;
  10102. ***************
  10103. *** 515,520 ****
  10104. --- 524,530 ----
  10105.    bulletproofWrite(filid,&dcmd,sizeof(dcmd));
  10106.    bulletproofWrite(filid,&dsectn,sizeof(dsectn));
  10107.    bulletproofWrite(filid,&bsectn,sizeof(bsectn));
  10108. +  bulletproofWrite(filid,&lcmd,sizeof(lcmd));
  10109.    bulletproofWrite(filid,&uthr,sizeof(uthr));
  10110.    bulletproofWrite(filid,&thflavor,sizeof(thflavor));
  10111.    bulletproofWrite(filid,&thcount,sizeof(thcount));
  10112.  
  10113. >From cs.cornell.edu!jhr Wed Apr 24 20:41:38 0400 1991
  10114. Received: by coma; Wed Apr 24 20:42:39 EDT 1991
  10115. Received: by inet.att.com; Wed Apr 24 20:42 EDT 1991
  10116. Received: from MAUI.CS.CORNELL.EDU by cloyd.cs.cornell.edu (5.65/I-1.98N)
  10117.     id AA00996; Wed, 24 Apr 91 20:41:38 -0400
  10118. Date: Wed, 24 Apr 91 20:41:38 -0400
  10119. From: jhr@cs.cornell.edu (John Reppy)
  10120. Message-Id: <9104250041.AA16310@maui.cs.cornell.edu>
  10121. Received: by maui.cs.cornell.edu (5.65/N-0.12)
  10122.     id AA16310; Wed, 24 Apr 91 20:41:37 -0400
  10123. To: dbm@research.att.com, oneill@cs.sfu.ca
  10124. Subject: Re: Getting Sml up and running on a NeXT running OS2.[01]
  10125. Cc: appel@cs.cornell.edu, jhr@cs.cornell.edu
  10126. Status: R
  10127.  
  10128. > From oneill@cs.sfu.ca Wed Apr 24 18:22:04 1991
  10129. > Long long ago, you (dbm) wrote:
  10130. > > I think we should have SML of NJ running on the 68040 NeXTs soon,
  10131. > > since John Reppy has just bought one of them (to write his thesis
  10132. > > on).  He is confident he can get SML running on it quite quickly.
  10133. > > I'll forward your message to him, since it looks like a useful start
  10134. > > on the problem.
  10135. > John Reppy also wrote:
  10136. > > It may be a while before I can fix this, since I still need to get a decent
  10137. > > sized disk.
  10138. > Well, after a month of messing about with other things, I finally got arround
  10139. > to getting sml working the NeXT (my NeXT arrived and so I could work on it at
  10140. > home). I'll tell you the problem and give my diffs. 
  10141. > ...
  10142.  
  10143. Thanks for the fix.  I'll merge these diffs into 0.69, and it should part
  10144. of 0.70 (whenever that is).
  10145.   - John
  10146.  
  10147. [jgm]
  10148. Rumor has it that jhr has 0.69 running on the NeXTstation?
  10149.  
  10150. Status: Fixed?
  10151.  
  10152. ---------------------------------------------------------------------------
  10153. 310. HP Cache flush problem
  10154. Submitter:      Nick Rothwell
  10155. Date:        23 May 1991
  10156. Version:        0.66
  10157. System:         HP9000/380 (a /300 with go-faster 68040 option)
  10158. Severity:       Critical for this system; fairly major overall
  10159. Problem:        Bombs with random bus errors or other traps on 68040-based
  10160.         HP machines. The build sequence runs, but not much else.
  10161.         Maybe it's a problem with saved images or something
  10162. Code:           <almost anything>
  10163. Transcript:
  10164.  
  10165. (i)    Standard ML of New Jersey, Version 0.66, 15 September 1990
  10166.     val it = () : unit
  10167.     - 3;
  10168.     EMT instruction (core dumped)
  10169.  
  10170. (ii)    Standard ML of New Jersey, Version 0.66, 15 September 1990
  10171.     val it = () : unit
  10172.     - 3;
  10173.     Segmentation fault (core dumped)
  10174.  
  10175. (iii)    Standard ML of New Jersey, Version 0.66, 15 September 1990
  10176.     val it = () : unit
  10177.     - 3;
  10178.     val it = 3 : int
  10179.  
  10180. (iv)    Standard ML of New Jersey, Version 0.66, 15 September 1990
  10181.     val it = () : unit
  10182.     - 3;
  10183.     exnCode: code was 0
  10184. Fix:
  10185.  
  10186. From: Andy Norman <ange@hplb.hpl.hp.com>
  10187.  
  10188. A solution to your problem is to change the caching to 'writethrough' instead
  10189. of 'copyback' on the data region of the dumped sml image. i.e.
  10190.  
  10191.   chatr -Cd sml
  10192.  
  10193. This is documented in the file /etc/newconfig/ReleaseNotes and on the man page
  10194. for chatr.
  10195.  
  10196. Hope this helps... a bit...
  10197.                     -- ange --
  10198.  
  10199.                     ange@hpl.hp.co.uk
  10200.  
  10201. From: Andrew Appel <appel@Princeton.EDU>
  10202. Message-Id: <9105240134.AA10277@cs.Princeton.EDU>
  10203. To: ange.hpl.hp.co.uk@cs.Princeton.EDU
  10204. Cc: dbm@inet.att.com
  10205.  
  10206. I'm intrigued by your mail about write-through.  Perhaps we can
  10207. still use write-back, if we flush the cache whenever the
  10208. garbage collector (etc.) moves code around.  There
  10209. is a provision in the runtime system to do this for machines
  10210. like the MIPS where the i-cache does not track updates to the
  10211. data.  Could this be the problem?  (grep for FLUSH in the runtime)
  10212. Status: Fixed?
  10213. ---------------------------------------------------------------------------
  10214. 311. abstype bug
  10215. Submitter: Russ Green (rjg@lfcs)
  10216. Date: 
  10217. Version: 
  10218. System: 
  10219. Severity: minor
  10220. Problem: doesn't compile the following abstype definition
  10221. Code: 
  10222.       abstype t = C1 | C2
  10223.       with fun f (x:t,y:t) = x=y
  10224.       end
  10225. [jgm] This is fixed under 0.69.
  10226. Fix: 
  10227. Status: Fixed
  10228. ---------------------------------------------------------------------------
  10229. 312. non-printable characters cause exception Abort to be raised
  10230. Submitter: John Reppy (jhr@cs.cornell.edu)
  10231. Date: Wed Feb 6 1991
  10232. Version: 0.69
  10233. Severity: minor
  10234. Problem: I've noticed that if you type a non-printable character (such as 
  10235. a control character), then you get an uncaught exception Abort.
  10236. Code: 
  10237. Transcript: 
  10238.   - ^W
  10239.   std_in:1.1 Error: illegal token
  10240.   
  10241.   uncaught exception Abort
  10242. Comment:  in parse/parse.sml, the first token is extracted from the
  10243. input stream in order to initialize the parse.  Unfortunately, this
  10244. is outside the scope of the appropriate exception handler.
  10245.  
  10246. Status: Fixed in 0.84
  10247. ---------------------------------------------------------------------------
  10248. 313. poor error message
  10249. Submitter: John Reppy (jhr@cs.cornell.edu)
  10250. Date: Thu, 20 Jun 91
  10251. Version: 0.69
  10252. System: 
  10253. Severity: minor
  10254. Problem: 
  10255. I tripped across a poor error message last night.  Assume we have a 7 line
  10256. file "xxx.sml" with the following contents:
  10257.  
  10258.   (* 1 *)  fun foo () = let
  10259.   (* 2 *)        fun bar () = let
  10260.   (* 3 *)              val z = 1
  10261.   (* 4 *)              in
  10262.   (* 5 *)                z
  10263.   (* 6 *)              end
  10264.   (* 7 *)  val w = 1
  10265.  
  10266. The error being that we forgot the body of foo's let.  The error message
  10267. that SML/NJ gives is:
  10268. Code: 
  10269. Transcript: 
  10270.   Standard ML of New Jersey, Version 0.69, 3 April 1991
  10271.   val it = () : unit
  10272.   - use "xxx.sml";
  10273.   [opening xxx.sml]
  10274.   xxx.sml:7.19 Error: syntax error found at EOF
  10275.   [closing xxx.sml]
  10276.   - 
  10277. Comments: 
  10278. When foo is in the middle of a 1000 line file, figuring out the source
  10279. of the error becomes quite hard.  If the error message had the line range, 
  10280. it would be a lot better.
  10281. Fix: perhaps allow specification in mlyacc that a three-token
  10282.      insertion should be tried; in this case  "in 0 end"
  10283.      Same approach could fix bug 206.
  10284. Status: open
  10285. ---------------------------------------------------------------------------
  10286. 314. unbalanced brackets on error message
  10287. Submitter: John Reppy (jhr@cs.cornell.edu)
  10288. Date: Mar 5 1991
  10289. Version: 0.66-0.69
  10290. Severity: minor
  10291. Problem: 
  10292. Minor bug in 0.66: if you use a non-existent file, the
  10293. resulting diagnostic has unbalanced brackets:
  10294.  
  10295. Standard ML of New Jersey, Version 0.66, 15 September 1990
  10296. val it = () : unit
  10297. - use "nonexistent";
  10298. [use failed: open_in "nonexistent": open failed, No such file or directory
  10299.  
  10300. Status: fixed in 0.74
  10301. ---------------------------------------------------------------------------
  10302. 315. bad weakness degree (too weak)
  10303. Submitter:      Bernard Berthomieu (bernard@laas.laas.fr)
  10304. Date:        11/15/90
  10305. Version:        0.66
  10306. System:         SUN Sparstation 1+, SunOS 4.0.3c
  10307. Severity:       minor
  10308. Problem:        bad weakness degree (too weak);
  10309. Code:           
  10310. Transcript:     - fun f g x = g x;
  10311.         val f = fn : ('a -> 'b) -> 'a -> 'b
  10312.         - f ref;
  10313.         std_in:2.1-2.5 Error: nongeneric weak type variable
  10314.           it : '0Z -> '0Z ref
  10315.         std_in:2.1-2.5 Error: nongeneric weak type variable
  10316.           it : '0Z -> '0Z ref
  10317.         -
  10318. Comments:    f ref should have type: '1a -> '1a ref
  10319.         (DBM: but can't tell this without examining the definition of f)
  10320. Status: not a bug
  10321. -------------------------------------------------------------------------
  10322. 316. stronger than required equality-type inference
  10323. Submitter:      Bernard Berthomieu (bernard@laas.laas.fr)
  10324. Date:        11/15/90
  10325. Version:        0.66
  10326. System:         SUN Sparstation 1+, SunOS 4.0.3c
  10327. Severity:       minor
  10328. Problem:        stronger than required equality-type inference
  10329. Code:           
  10330. Transcript:     - datatype 'a new = N of 'a ref;
  10331.         datatype 'a  new
  10332.         con N : 'a ref -> 'a new
  10333.         - fun f (X as ref x) (Y as ref y) = N X = N Y;
  10334.         val f = fn : ''a ref -> ''a ref -> bool
  10335.         -
  10336. Comments:    Not really a bug, but confusing. I may understand the
  10337.         reason why, but type of f above is unnecessarily strong;
  10338.         type 'a ref -> 'a ref -> bool would be enough as equality
  10339.         property for type constructor "new" does not depend upon
  10340.         its type argument (due to the ref in "N of 'a ref").
  10341.         It is surprising that references to functions would admit
  10342.         equality, while    constructions from these by N (as built
  10343.         in function f) would not. e.g.
  10344.  
  10345.         - let val r = ref (fn x=>x) in r=r end;
  10346.         val it = true : bool
  10347.         - let val r = ref (fn x=>x) in N r = N r end;
  10348.         std_in:3.1-3.47 Error: operator and operand don't agree
  10349.                             (equality type required)
  10350.           operator domain: ''Z * ''Z
  10351.           operand:         ('0Y -> '0Y) new * ('0Y -> '0Y) new
  10352.           in expression:
  10353.             = (N r,N r)
  10354.         - 
  10355.                 - datatype 'a new0 = N0;
  10356.         - fun g x = x=N0;
  10357.         val g = fn : ''a new0 -> bool
  10358.         -
  10359. Comments:    g should have type: 'a new0 -> bool
  10360.         (DBM: see TACS paper)
  10361. Status: not a bug
  10362. -------------------------------------------------------------------------
  10363. 317. eqtypes and abstype
  10364. Submitter: Simon Finn (simon@abstract-hardware-ltd.co.uk)
  10365. Date: Sep 20, 1990
  10366. Version: 0.69
  10367. Severity: 
  10368. Problem: shouldn't allow since the datatype constructor "Y" doesn't
  10369. respect equality in the final environment (since it maps the non-equality
  10370. type "abs" to the equality type "repp").  Poly/ML [and SML/NJ] fail
  10371. to detect this.
  10372. Code: 
  10373.   abstype abs = X of int 
  10374.   with
  10375.     datatype rep = Y of abs;
  10376.     val foo = X 1
  10377.   end;
  10378.   fun eq x y = Y x = Y y;
  10379.   eq foo foo;
  10380. Transcript: 
  10381.   type abs
  10382.   con Y : abs -> rep
  10383.   val foo = - : abs
  10384.   val eq = fn : abs -> abs -> bool
  10385.   val it = true : bool
  10386.  
  10387. Status: open
  10388. ---------------------------------------------------------------------------
  10389. 318. rebinding of type operator "*"
  10390. Submitter:      Bernard Berthomieu (bernard@laas.laas.fr)
  10391. Date:        11/13/90
  10392. Version:        0.66
  10393. System:         SUN Sparstation 1+, SunOS 4.0.3c
  10394. Severity:       minor
  10395. Problem:        One is allowed to rebind type operator "*", but the new "*"
  10396.         is not properly handled in types, and old product type
  10397.         operator still present.
  10398. Code:           
  10399. Transcript:     - datatype * = P;
  10400.         datatype  *
  10401.         con P : *
  10402.         - P;
  10403.         val it = P : *
  10404.         - fun f (x : *) = P;
  10405.         std_in:5.12 Error: syntax error found at ASTERISK
  10406.         - fun f (x : 'a * 'b) = (1,2);
  10407.         val f = fn : 'a * 'b -> int * int
  10408. Comments:    Is it really safe to allow rebinding of product type ? This
  10409.         operator must be parsed as special case anyway, as product type
  10410.         operator does not obey the same syntax as user definable type
  10411.         operators. Further, function type operator may not be rebound.
  10412.  
  10413. [jgm] see Dave Tarditi's comments --  (x: *) is a syntax error since *) is
  10414. a close comment delimiter.
  10415. Fix:
  10416. Status: fixed
  10417. ------------------------------------------------------------------------------
  10418. 319. bad weakness degree (not weak enough)
  10419. Submitter:      Thierry Le Sergent (lesergen@laas.laas.fr)
  10420. Date:        11/13/90
  10421. Version:        0.66
  10422. System:         SUN Sparstation 1+, SunOS 4.0.3c
  10423. Severity:       major
  10424. Problem:        bad weakness degree (not weak enough);
  10425.         may create toplevel polymorphic references;
  10426. Code:           
  10427. Transcript:     - fun f x = let fun g z = ref x in g 3 end;
  10428.         val f = fn : '2a -> '2a ref
  10429.         - f [];
  10430.         val it = ref [] : '1a list ref
  10431. Comments:    f above should have type '1a -> '1a ref;
  10432. Fix: propagate weakness for free as well as bound type variables
  10433.      (function instantiateType in basics/typesutil.sml).
  10434. Status: fixed in 0.72
  10435. ------------------------------------------------------------------------------
  10436. 320. bad weakness degree (too weak)
  10437. Submitter:      Bernard Berthomieu (bernard@laas.laas.fr)
  10438. Date:        11/13/90
  10439. Version:        0.66
  10440. System:         SUN Sparstation 1+, SunOS 4.0.3c
  10441. Severity:       minor
  10442. Problem:        bad weakness degree (too weak);
  10443. Code:           
  10444. Transcript:     - fun f x = (ref x; fn x=>x) x;
  10445.         std_in:1.5-1.28 Error: nongeneric weak type variable
  10446.           f : '0Z -> '0Z
  10447.         std_in:1.5-1.28 Error: nongeneric weak type variable
  10448.           f : '0Z -> '0Z
  10449.         - fun g x y = (ref x; fn x=>x) x;
  10450.         val g = fn : '1a -> 'b -> '1a
  10451. Comments:    f above should have type '1a -> '1a
  10452.         g above should have type '2a -> 'b -> '2a
  10453.         some rator forms confuse the type checker; which
  10454.         generate higher weakness degrees than expected.
  10455. Fix: added base field to type absp in typing/typecheck.sml (but see bug 539).
  10456. Status: fixed in 0.67
  10457. ------------------------------------------------------------------------------
  10458. 321. top level polymorphic exceptions allowed
  10459. Submitter:      Bernard Berthomieu (bernard@laas.laas.fr)
  10460. Date:        11/13/90
  10461. Version:        0.66
  10462. System:         SUN Sparstation 1+, SunOS 4.0.3c
  10463. Severity:       minor
  10464. Problem:        top level polymorphic exceptions allowed
  10465. Transcript:     - exception X of '0a;
  10466.         exception X
  10467.         - fun f x = raise X x;
  10468.         val f = fn : '0aU -> 'a
  10469.         - fun g h x = h x handle X y => y;
  10470.         val g = fn : ('a -> '0aU) -> 'a -> '0aU
  10471. Comments:    This would be a bug if I could raise that exception, but
  10472.         I could not; so ?
  10473.         As a comment, I would prefer the compiler to infer automatically
  10474.         weakness degrees for arguments of polymorphic exceptions,
  10475.         rather than asking the user to (sometime unconsistently)
  10476.         apply a type constraint. Weakness degrees are neglected in
  10477.         types appearing in, e.g., datatype declarations; I think this
  10478.         is a good practice, that I would generalize to all types
  10479.         written by the user.
  10480. Status: fixed in 0.74
  10481. ------------------------------------------------------------------------------
  10482. 322. unreachable constructors should not be printed
  10483. Submitter:      Bernard Berthomieu (bernard@laas.laas.fr)
  10484. Date:        11/13/90
  10485. Version:        0.66
  10486. System:         SUN Sparstation 1+, SunOS 4.0.3c
  10487. Severity:       minor
  10488. Problem:        unreachable constructors should not be printed
  10489. Code:           
  10490. Transcript:     - fun f x = let exception X of '1a in raise X x end;
  10491.         val f = fn : '1a -> 'b
  10492.         - f 5;
  10493.         uncaught exception X
  10494.         - fun f x = let datatype new = N in N end;
  10495.         val f = fn : 'a -> ?.new
  10496.         - f 1;
  10497.         val it = N : ?.new
  10498. Comments:    Not a bug, but confusing, as X and N above are not reachable
  10499.         at toplevel; and some reachable values may be printed as these.
  10500. Fix:
  10501. Status: not a bug, but confusing
  10502. ------------------------------------------------------------------------------
  10503. 323. blast_read/write should have types
  10504. Submitter: Jawahar (malhotra%metasoft.uucp@BBN.COM)
  10505. Date: Wed, 8 May 91
  10506. Version: 0.69
  10507. Severity: minor
  10508. Problem: I'm trying to use blast_read/write to dump some functors into a file
  10509. in binary form and then reload them in another image. I tried a small
  10510. experiment and found that it causes a segmentation fault. Is there
  10511. something I'm doing wrong?
  10512.  
  10513. I used:
  10514.     - val x = {a=34,b=78};
  10515.     - System.Unsafe.blast_write (x, "x.bl");
  10516.     
  10517.     and
  10518.     
  10519.     - System.Unsafe.blast_write ("x.bl", x);
  10520. both of them failed.
  10521. Code: (see above)
  10522. Transcript: 
  10523. Comments: 
  10524. [jgm]
  10525. The first argument of blast_write and the argument of blast_read
  10526. should be of type outstream and instream respectively.  In system.sig,
  10527. they're given types 'outstream * 'a -> unit and 'instream -> 'a making
  10528. them polymorphic.  I'm sure there's a reason for this, but I don't
  10529. know what it is.
  10530.  
  10531. Status: fixed in 0.84
  10532. ---------------------------------------------------------------------------
  10533. 324. bulletproofWrite dies in a bad way when out of disk space
  10534. Submitter: Larryf Paulson (Larry.Paulson@computer-lab.cambridge.ac.uk)
  10535. Date: 27 Nov 90
  10536. Version: 
  10537. System: 
  10538. Severity: minor 
  10539. Problem: when out of disk space, an exportML dies in an ugly way.
  10540. Code: 
  10541. Transcript: 
  10542. A New Jersey execution failed giving the following message.  Do you know what
  10543. it means?  Out of memory perhaps?                Larry
  10544.  
  10545. [Major collection... 99% used (1915968/1921456), 4860 msec]
  10546. bulletproofWrite, errno = 28
  10547. *** Error code 3
  10548. Comments: 
  10549.  
  10550. The bulletproofWrite error you got was probably from an exportML, no?
  10551. It's not out of memory; you have no space left on your disk.
  10552. However, we should provide a better error message, of course.
  10553.  
  10554. Status: fixed in 0.71
  10555. ---------------------------------------------------------------------------
  10556. 325. import and symlinks
  10557. Submitter: 
  10558.     Juergen Buntrock,
  10559.     TU-Berlin,
  10560.     jubu@cs.tu-berlin.de
  10561. Date: Mon Apr  8 15:52:46 MET DST 1991
  10562. Version: Standard ML of New Jersey, Version 0.65, 10 September 1990 
  10563. System: Sun3-260 / SunOS Release 4.0.3_Export 
  10564.     Sun4-370 / SunOS Release 4.1.1
  10565. Problem: 
  10566.     if the source file is a symbolik link
  10567.     import checks the modification time of the link
  10568.     but not of the file.
  10569. Fix:
  10570.  
  10571. *** cfuns.c.new Tue Apr  9 12:11:46 1991
  10572. --- cfuns.c.org Wed Aug 22 15:28:17 1990
  10573. ***************
  10574. *** 715,721 ****
  10575.       int                   sts;
  10576.  
  10577.       if (OBJ_isBOXED(f))
  10578. !       sts = stat((char *)PTR_MLtoC(f), buf);
  10579.       else
  10580.         sts = fstat(INT_MLtoC(f), buf);
  10581.  
  10582. --- 715,721 ----
  10583.       int                   sts;
  10584.  
  10585.       if (OBJ_isBOXED(f))
  10586. !       sts = lstat((char *)PTR_MLtoC(f), buf);
  10587.       else
  10588.         sts = fstat(INT_MLtoC(f), buf);
  10589.  
  10590. Comments:
  10591.     I use symbolik-links to share the source-code
  10592.     but not the bin-files for architectures sun3 and sun4
  10593.  
  10594. Status: Fixed (defunct feature)
  10595. -------------------------------------------------------------------------
  10596. 326.  very big arrays
  10597.  
  10598. Submitter: 
  10599.     Juergen Buntrock,
  10600.     TU-Berlin,
  10601.     jubu@cs.tu-berlin.de
  10602. Date: Tue Apr  9 12:40:24 MET DST 1991
  10603. Version: Standard ML of New Jersey, Version 0.65, 10 September 1990 
  10604. System: Sun3-260 / SunOS Release 4.0.3_Export 
  10605.     Sun4-370 / SunOS Release 4.1.1
  10606. Problem: 
  10607.     creating very big arrays leads to the message:
  10608.     [Minor collection...bug: insufficient to_space
  10609. Comments:
  10610. [jgm]
  10611. I tried fairly large arrays under 0.69 (10,000,000 integers) and
  10612. everything worked fine.  
  10613.  
  10614. Fix:    don't know
  10615. Status: Fixed
  10616. -------------------------------------------------------------------------
  10617. 327. large constants cause overflow in compilation
  10618.     Submitter: 
  10619.     Juergen Buntrock,
  10620.     TU-Berlin,
  10621.     jubu@cs.tu-berlin.de
  10622. Date: Tue Apr 23 13:50:05 MET DST 1991
  10623. Version: Standard ML of New Jersey, Version 0.69, 3 April 1991
  10624. System: Sun4-370 / SunOS Release 4.1.1
  10625. Problem: 
  10626.     Big integer constants leads to an uncaught exception Overflow
  10627.     in codegen.
  10628. Script:
  10629.  
  10630. Script started on Tue Apr 23 13:39:20 1991
  10631. jubu@flp jubu/ml_bugs 1) smlp69
  10632. Standard ML of New Jersey, Version 0.69, 3 April 1991
  10633. val it = () : unit
  10634. - val x = 1024 * 1024 * 512;
  10635. val x = 536870912 : int
  10636. - val maxint = x + ( x - 1 );
  10637. val maxint = 1073741823 : int
  10638. - System.Control.debugging := true;
  10639. execution
  10640. val it = () : unit
  10641. - 1073741823;
  10642. parse
  10643. semantics
  10644. debug instrument
  10645. translate
  10646. convert
  10647. cpsopt
  10648. closure
  10649. globalfix
  10650. spill
  10651. codegen
  10652.  
  10653. uncaught exception Overflow
  10654. - 1;
  10655. parse
  10656. semantics
  10657. debug instrument
  10658. translate
  10659. convert
  10660. cpsopt
  10661. closure
  10662. globalfix
  10663. spill
  10664. codegen
  10665. done
  10666. about to boot
  10667. code size =300
  10668. codegen
  10669.  
  10670. uncaught exception Overflow
  10671. - 1;
  10672. parse
  10673. semantics
  10674. debug instrument
  10675. translate
  10676. convert
  10677. cpsopt
  10678. closure
  10679. globalfix
  10680. spill
  10681. codegen
  10682. done
  10683. about to boot
  10684. code size =188
  10685. codegen
  10686. execution
  10687. val it = 1 : int
  10688. jubu@flp jubu/ml_bugs 2)
  10689. script done on Tue Apr 23 13:41:24 1991
  10690.  
  10691. Fix:
  10692. Status: Fixed as of version 0.69
  10693. ---------------------------------------------------------------------------
  10694. 328. callcc not tail recursive
  10695. Submitter: John Reppy (jhr@cs.cornell.edu)
  10696. Date: Jan 14 1991
  10697. Version: 
  10698. System: 
  10699. Severity: minor
  10700. Problem: callcc is not tail-recursive
  10701. Code: 
  10702. Transcript: 
  10703. Comments: 
  10704. Fix: 
  10705. To make callcc tail-recursive, replace the "callcc" conversion
  10706. code of cps/convert.sml (starting at line 201) with the following:
  10707.  
  10708.  
  10709.      of Lambda.APP(Lambda.PRIM P.callcc, f) => let
  10710.       val h = mkLvar() and k = mkLvar() and x = mkLvar()
  10711.       val k' = mkLvar() and x' = mkLvar()
  10712.       in
  10713.       (* k is the callcc return cont, k' is the argument cont. *)
  10714.         FIX([(k, [x], c (VAR x))],
  10715.           PRIMOP(P.gethdlr, [], [h],
  10716.         [FIX(
  10717.           [(k', [x'], PRIMOP(P.sethdlr, [VAR h], [], [APP(VAR k, [VAR x'])]))], 
  10718.           conv (f, fn vf => APP(vf, [VAR k', VAR k])))]))
  10719.       end
  10720. Status: Fixed
  10721. ---------------------------------------------------------------------------
  10722. 329. checkopen broken
  10723. Submitter: John Reppy (jhr@cs.cornell.edu)
  10724. Date: Dec 6 1990
  10725. Version: 0.67
  10726. System: 
  10727. Severity: major
  10728. Problem: Compiling Dave Berry's library produces a compiler bug in 0.67
  10729.   Error: Compiler bug: EnvAccess.checkopen.test
  10730. Code: 
  10731. Transcript: 
  10732.   Standard ML of New Jersey, Version 0.67, 21 November 1990
  10733.   val it = () : unit
  10734.   - use "nj-sml.load";
  10735.   [opening nj-sml.load]
  10736.   ...
  10737.   [closing nj-sml.load]
  10738.   val it = () : unit
  10739.   - use "build.sml";
  10740.   [opening build.sml]
  10741.   ...
  10742.   [closing ../signatures/InStreamType.sml]
  10743.   val it = () : unit
  10744.   structure Types :
  10745.     sig
  10746.       eqtype InStream
  10747.     end
  10748.   open Types
  10749.   Error: Compiler bug: EnvAccess.checkopen.test
  10750.   structure Types :
  10751.     sig
  10752.     end
  10753.   [opening outStream.sml]
  10754.   ...
  10755.  
  10756. Comments: 
  10757. >From Lal George:
  10758. The bug seems simple; checkopen.test was complaining if anything other
  10759. than vals, exceptions, or structures were defined within a structure! The
  10760. problem was only visible if this other thing (e.g., a type declaration)
  10761. came before test had a chance to raise NotStale on something else. A 
  10762. revised version of test is as follows:
  10763.  
  10764. Fix: 
  10765.     let fun test (s:symbol) =
  10766.         case Env.look newenv s
  10767.           of VARbind(VALvar{access=PATH(v'::_),...}) =>
  10768.           if v' = v then raise NotStale else ()
  10769.            | CONbind(DATACON{rep=VARIABLE(PATH(v'::_)),...}) =>
  10770.           if v' = v then raise NotStale else ()
  10771.            | STRbind(STRvar{access=PATH(v'::_),...}) =>
  10772.           if v' = v then raise NotStale else ()
  10773.            | _ => ()
  10774. Status: Fixed -- however, the fix in 0.69 adds another arm to the
  10775. case after the CONbind:
  10776.  
  10777.                | CONbind(DATACON{rep=VARIABLEc(PATH(v'::_)),...}) =>
  10778.                   if v' = v then raise NotStale else ()
  10779. ---------------------------------------------------------------------------
  10780. 330. comments bug
  10781. Submitter: David Tarditi (dtarditi@cs.cmu.edu)
  10782. Date: 17 May 1991
  10783. Version: 0.69
  10784. System: 
  10785. Severity: minor
  10786. Problem: 
  10787. According to Appendix D of the Commentary on Standard ML,
  10788. an unmatched right comment bracket should be detected by
  10789. the compiler.  Thus the expression (op *) is illegal.
  10790.  
  10791. Version 0.69 does not detect unmatched right comment brackets,
  10792. and parses (op *).
  10793. Code: 
  10794.                 (op *)(1,2);
  10795. Transcript: 
  10796.               - (op *)(1,2);
  10797.               val it = 2 : int
  10798. Comments: 
  10799. Fix: add the following line to the lexer:
  10800. <INITIAL>"*)"    => (err(yypos,yypos+1) COMPLAIN "unmatched close comment"; continue());
  10801. Status: fixed in 0.71
  10802. ---------------------------------------------------------------------------
  10803. 331. type variable generalized wrongly
  10804. Submitter: Mike Fourman (mikef@lfcs.edinburgh.ac.uk)
  10805. Date: Apr 16 1991
  10806. Version: 
  10807. System: 
  10808. Severity: major? 
  10809. Problem: 
  10810. The following is not legal ML and is rejected by PolyML,
  10811. Poplog ML and the Edinburgh Kit compiler.
  10812. NJ-ML and the old Edinburgh ML (wrongly) accept it.
  10813.  
  10814. fn x => let val y : 'a -> 'a = fn z => x in y end;
  10815.  
  10816. Error message from the Kit compiler (the others are more obscure):
  10817.  
  10818.   The following type variables could not be bound,
  10819.   even though they are scoped at this declaration.
  10820.  
  10821.   'a
  10822.  
  10823. Code: 
  10824.       fn x => let val y : 'a -> 'a = fn z => x in y end;
  10825. Transcript: 
  10826. Comments:
  10827. Comment from David Turner:
  10828.  
  10829. Once the new parser has been properly integrated,
  10830. the above error will also show the declaration
  10831. where the type variable was scoped (as below).
  10832.  
  10833.   fn x => let val y : 'a -> 'a = fn z => x in y end;
  10834.               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  10835.   The following type variables could not be bound,
  10836.   even though they are scoped at this declaration.
  10837.  
  10838.   'a
  10839.  
  10840. Fix: 
  10841. Status: Fixed as of 0.69
  10842. ---------------------------------------------------------------------------
  10843. 332. Allows null datatype constructor to be matched as a unit -> type function.
  10844. Submitter:     stark@cs.sunysb.edu (Gene Stark)
  10845. Date:         1/26/91
  10846. Version:     0.66 and 0.69
  10847. System:         SparcStation SLC, SunOS 4.0.3c
  10848. Severity:     major
  10849. Problem:     Fails to type-check datatype constructors in functor body
  10850.         against specifications in signature.  Mismatched types
  10851.         result in core dump when constructor is used incorrectly.
  10852. Code:         The compiler allows the following code:
  10853.  
  10854.             signature SIG = sig
  10855.                 type value;
  10856.                 val NIL: unit -> value
  10857.             end
  10858.  
  10859.             functor Foo(): SIG = struct
  10860.                 datatype value = NIL
  10861.             end;
  10862.  
  10863.         After importing this code, executing the following
  10864.         causes a bus error:
  10865.  
  10866.             structure Str = Foo();
  10867.             open Str;
  10868.             NIL();
  10869. Status: fixed in 0.73
  10870. ---------------------------------------------------------------------------
  10871. 333. code generation bug
  10872. Submitter:      David Turner <dnt@uk.ac.ed.lfcs>
  10873. Date:           31/10/90
  10874. Version:        SML of NJ version 0.66
  10875. System:         Mips, Sun3, Sun4, HP9000
  10876. Severity:       ?
  10877. Problem:        Code generation problem causing ml to crash ?
  10878. Code:
  10879.  
  10880.   (* This code has been distilled to narrow down the error! *)
  10881.   fun sine x = (if 1 mod 4 = 0 then exp(x) else exp(real 1 * x)) / sine x
  10882.  
  10883. Transcript:
  10884.   uncaught exception Regbind
  10885.   (* Doesn't matter too much what you type here, the whole system
  10886.   seems to have been corrupted. *)
  10887.   - sin; 
  10888.   Illegal instruction
  10889.  
  10890. Comments:
  10891.   This happen on all the machines mentioned above (nearly
  10892.   always via an illegal instruction).
  10893.  
  10894. This is clearly a problem with the new CPS stuff, but I'd like to
  10895. again point out the other problem: code generation bugs, such as
  10896. this one or the shift bug on the sparc, cause the system to get into
  10897. some kind of corrupted state, which causes a core dump on the next
  10898. top-level definition.  I think that there needs to be a catch-all
  10899. exception handler wrapped around code generation stuff, which will
  10900. restore things to a reasonable state.
  10901.   - John
  10902.  
  10903. The problem with System.Unsafe.Weak is that John forgot to make it an
  10904. abstraction rather than a Structure.  If this is fixed, haven no longer
  10905. dumps core; I would hope shamash wouldn't get wedged either, though I don't
  10906. intend to try the experiment!
  10907.  
  10908. Andrew
  10909.  
  10910. Trying to reproduce a bug that occurs on haven in 67, I typed
  10911.  
  10912. open System.Unsafe.Weak;
  10913. strong 1;
  10914.  
  10915. This should give a typechecking error, but on haven, it causes a Bus Error.
  10916. It looks like on shamash it wedges the machine!
  10917. I'm investigating further on other machines.
  10918. Status: Fixed as of 0.69
  10919. ---------------------------------------------------------------------------
  10920. 334. adjust_limit in M68.prim.s
  10921. Submitter:      Andre Kramer     akramer@ecrc.de 
  10922. Date:           May  2 
  10923. Version:        0.66
  10924. System:         m68 (sun3 sunos)
  10925. Severity:       major?
  10926. Problem:        
  10927.                 adjust_limit in M68.prim.s trashes d0 with a 
  10928.                 comment that ml does not use it. 
  10929.                 It appears that ML does use d0 (e.g. floating
  10930.                 point primitives in same file). 
  10931.  
  10932. Code:           I had an alarm signal handler causing random
  10933.                 crashes. 
  10934. Transcript:     .
  10935.  
  10936. Comments:       Sparc is ok. 
  10937.  
  10938. Fix:
  10939.  
  10940. adjust_limit:
  10941.         movw    cc,d5             /* save condition codes */ 
  10942.         movl    _saved_pc,sp@-
  10943.         movw    d5,sp@-           /* push the saved condition codes */
  10944.         clrl    d5                /* generate a trap on the next limit check */
  10945.         rtr                       /* return, restoring condition codes */
  10946. Status: Fixed in 0.74.
  10947. ---------------------------------------------------------------------------
  10948. 335. Dave Berry's library won't compile
  10949. Submitter:      Richard O'Neill (oneill@cs.sfu.ca)
  10950. Date:        Wed Apr 24 09:57:05 PDT 1991
  10951. Version:        0.68-0.69
  10952. System:         NeXTstation, OS2.1
  10953. Severity:       Major
  10954. Problem:        
  10955.  
  10956. The current 'working' version cannot compile Dave Berry's library (as in 
  10957. dblibrary.tar.Z in dist/ml on research.att.com). It chuggs away for a while 
  10958. but finally comes up with a Runbind exception. I can't say if it works for
  10959. previous releases as 0.69 is the first version that runs on a NeXT under OS2.1,
  10960. and thus the first release I have been able to run in a while.
  10961.  
  10962. Transcript:
  10963.  
  10964. Standard ML of New Jersey, Version 0.69, 3 April 1991
  10965. val it = () : unit
  10966. - use "nj-sml.load";
  10967.     .
  10968.     .
  10969.     .
  10970. - use "build_all.sml";
  10971. [opening build_all.sml]
  10972. val loadEntry = fn : string -> unit
  10973. val loadSig = fn : string -> unit
  10974. val loadLocalSig = fn : string -> unit
  10975. val setLoadPrefix = fn : string -> unit
  10976. val setLoadSigPrefix = fn : string -> unit
  10977.      ...
  10978. [opening Int.sml]
  10979. [opening ../signatures/INT.sml]
  10980. signature INT =
  10981.   sig
  10982.     eqtype T
  10983.     eqtype int
  10984.       ...
  10985.     val ~ : int -> int
  10986.   end
  10987. [closing ../signatures/INT.sml]
  10988. val it = () : unit
  10989.  
  10990. [Major collection... 36% used (948744/2627428), 814 msec]
  10991. [closing Int.sml]
  10992. [closing build_all.sml]
  10993.  
  10994. uncaught exception Runbind
  10995. Status: fixed in 0.74
  10996. ---------------------------------------------------------------------------
  10997. 336. $$lookTycPath diagnostic message
  10998. Submitter: Andre Appel (appel@princeton.edu)
  10999. Date: Jun 3 1991
  11000. Version: 0.69
  11001. System: 
  11002. Severity: minor?
  11003. Problem: Reminder: for 0.70 SML/NJ remove the $$lookTycPath diagnostic message.
  11004. Fix: 
  11005. Status: fixed in 0.73
  11006. ---------------------------------------------------------------------------
  11007. 337. double error message
  11008. Submitter:      John Ophel jlophel@watmsg.waterloo.edu
  11009. Date:           4/1/91
  11010. Version:        0.66
  11011. System:         Vax, Unix
  11012. Severity:       very minor
  11013. Problem:        repeated error message
  11014.  
  11015. Transcript:
  11016.  
  11017. -  val g = (fn x => (fn y => (ref x, ref(x,y))));
  11018. val g = fn : '2a -> '2b -> '2a ref * ('2a * '2b) ref
  11019. - val h = g(nil);
  11020. val h = fn : '1a -> '1b list ref * ('1b list * '1a) ref
  11021. - h true;
  11022. std_in:4.1-4.6 Error: nongeneric weak type variable
  11023.   it : '0Z list ref * ('0Z list * bool) ref
  11024. std_in:4.1-4.6 Error: nongeneric weak type variable
  11025.   it : '0Z list ref * ('0Z list * bool) ref
  11026.  
  11027. Comments:
  11028.  
  11029.   I tried to generate the double error message with a simpler code
  11030. but couldn't.
  11031.  
  11032. John
  11033. Status: fixed in 0.74
  11034. ---------------------------------------------------------------------------
  11035. 338. local datatypes
  11036. Submitter: Bruce Duba (duba@rice.edu)
  11037. Date: Nov 8 1990
  11038. Version:
  11039. System: 
  11040. Severity: major
  11041. Problem: 
  11042. Is the following a bug or am I confused? I didn't expect the application of
  11043. f1 to a2 to type check. 
  11044. Code: 
  11045.   fun new() = let datatype A = A
  11046.           in (A,fn A => ())
  11047.           end
  11048.   val (a1,f1) = new()
  11049.   val (a2,f2) = new()
  11050.   val x = f1 a2
  11051.  
  11052. Status: not a bug
  11053. ---------------------------------------------------------------------------
  11054. 339. type = allowed
  11055. Submitter: Nick Rothwell (nick@lfcs.edinburgh.ac.uk)
  11056. Date: Nov 8 1990
  11057. Version: 
  11058. System: 
  11059. Severity: minor
  11060. Problem: SML/NJ allows the following code
  11061. Code: 
  11062.    signature S = sig type = end;
  11063. Transcript: 
  11064. Comments: 
  11065. Here, "=" is clearly not standing for the equality predicate (even though
  11066. it's not being rebound), so this is illegal.
  11067.  
  11068. The status of something like
  11069.  
  11070.   signature S =
  11071.     sig
  11072.       structure T: sig ... end sharing type T.t = T.*
  11073.     end;
  11074.  
  11075. is less clear. "*" is not allowed as a TyCon, but "T.*" presumably is (even
  11076. though no matching signature for "T" would be syntactically possible to
  11077. write).
  11078.  
  11079. Sender: David.Tarditi@b.gp.cs.cmu.edu
  11080. Status: RO
  11081.  
  11082. Here are some answers to the questions about parsing in SML/NJ raised
  11083. by Nick Rothwell.  First, the processing of infix operators is handled
  11084. by an operator precedence parser after parsing is finished.  The ML-Yacc
  11085. grammar essentially allows allow any string of legal identifiers in certain
  11086. places; the operator precedence parser sorts it out later.  (As a side note,
  11087. this make syntactic error correction much harder).  Yes, this means
  11088. that we don't have a "pure" LALR grammar, but I don't see any way anyone
  11089. could have one with the precedence scheme used in ML.  
  11090.  
  11091. The parser deals with "=" and "*" by always regarding them as reserved words.
  11092. To put it another way, the lexer always returns separate tokens for these
  11093. values.   This reduces our problem to deciding where exactly "=" and "*"
  11094. should be permitted to be used in place of identifiers.
  11095.  
  11096. The following rules sort this out:
  11097.  
  11098. "*" can always be used in place of an identifier, except in the syntactic
  11099.     class "TyCon"
  11100.  
  11101. "=" can only be used in place of an identifier in an expression.
  11102.     Since it cannot be rebound, it cannot be used as an identifier
  11103.     in pattern.
  11104.  
  11105. As Nick Rothwell has pointed out, there are some mistakes in SML/NJ
  11106. where these rules are violated.  To summarize the problems found so
  11107. far:
  11108.  
  11109. (1) Allows * to be used as TyCon in type specifications.  This is clearly
  11110.     illegal SML (see p.  13 of the Definition).
  11111.  
  11112. Example:
  11113.     sig
  11114.       type *
  11115.         end
  11116.  
  11117. (2) Allows = to be used as TyCon in type specifications.  Since this
  11118.     isn't the equality predicate, this is wrong.
  11119.  
  11120. Example:
  11121.     sig
  11122.        type =
  11123.     end
  11124.  
  11125. (3) Doesn't allow "*" to be used as a record label.  This is clearly
  11126.     allowed, since "*" is just an identifier.
  11127.  
  11128. Example
  11129.     {* = 5}
  11130.  
  11131. All of these can be fixed by some minor changes to the grammar using by
  11132. SML/NJ, without making the grammar ambiguous.
  11133.  
  11134. With regard to parsing examples:
  11135.  
  11136. (1)  This is complicated, but not ambiguous.  
  11137.  
  11138.    val x = {A=B=C=D=E, B=((X=Y), {X=Y}, X=Y), X=Y};
  11139.  
  11140. binds  x to a record with fields A,B, and X.  Field A is set to the boolean
  11141. value of ((B=C)=D)=E),  Field B is a tuple of type bool * {X:bool} * bool,
  11142. and Field X is set to the value of Y.   Thus:
  11143.  
  11144.      val B=1 and C=1 and D=true and E=true and X=1 and Y=1
  11145.      val x = {A=B=C=D=E,B=((X=Y), {X=Y}, X=Y), X=Y}
  11146.  
  11147. gives:
  11148.  
  11149.      val x = {A=true,B=(true,{X=1},true),X=1) :
  11150.         {A:bool,B : bool * {X : int} * bool, X : int}
  11151.       
  11152.  
  11153. (2) This is legal; the Definition says nothing about rebinding the
  11154.     precedence of =.  It won't typecheck though, since function types
  11155.     are not equality types.
  11156.  
  11157.    nonfix =
  11158.    val x = = and y = {A= =(=, =), B = =}
  11159.  
  11160. (3) This should be illegal, but isn't.  It shows that SML is
  11161.     inherently ambiguous for any fixed lookahead k.
  11162.  
  11163.    nonfix =
  11164.    fun f x = = | f y = case y of 1 => = | 2 => = | f z = =
  11165.  
  11166.     The reason is best illustrated with this simpler case
  11167.  
  11168.         fun f x = case y of 1 => 1 | f z = 3
  11169.  
  11170.     The "| f z = 3" phrase should go with "fun f x", not with
  11171.     the case statement clause.  A parser cannot decide this, however,
  11172.     until it sees that the "=" is not an "=>".  However, z can be an
  11173.     arbitrarily complex pattern, so for fixed lookahead k we can choose
  11174.     some pattern that requires lookahead of k+1 tokens.
  11175.  
  11176.     There isn't much you can do about this, short of changing the language
  11177.     definition.
  11178.  
  11179.     The following variant is legal, by the way:
  11180.  
  11181.    nonfix =
  11182.    fun f x = = |00 stlouis8913372 "" \r\d in:--in: nuucp word: nuucpNUUCP
  11183. to the problem of infixes in signatures making
  11184. separate parsing and typehcecking passes difficult, it is already
  11185. impossible (I think) to separate the parsing and typechecking
  11186. completely.  The infix status of an identifier cannot be determined
  11187. without the use of static semantics information.
  11188.  
  11189. You could separate the passes as:
  11190.  
  11191. (1) parsing
  11192. (2) typechecking plus parsing of infix identifiers
  11193.  
  11194. if you insist on this kind of division.
  11195.  
  11196.   Dave
  11197. Fix: 
  11198. Status: Fixed as of 0.69
  11199. ---------------------------------------------------------------------------
  11200. 340. = specification allowed
  11201. Submitter: Nick Rothwell (nick@lfcs.edinburgh.ac.uk)
  11202. Date: 8 Nov 1990
  11203. Severity: minor
  11204. Problem: 
  11205. The following (legal - I think) signature is accepted by SML/NJ and
  11206. rejected by Poly/ML and Poplog/ML:
  11207. Code: 
  11208.       signature S = 
  11209.         sig val = : 'a * 'a -> bool
  11210.             end
  11211.  
  11212. also
  11213.           signature S =
  11214.             sig val = : int
  11215.             end
  11216. Transcript: 
  11217. Comments: 
  11218. Is this legal? "val =" is only allowed if the "=" is standing for the
  11219. equality predicate (Defn. p.4). Does its appearance in a spec. count? What
  11220. about
  11221.  
  11222.   sig
  11223.     val = : int
  11224.   end
  11225.  
  11226. where it can't possibly be the equality predicate.
  11227.  
  11228. Status: not much of a bug
  11229. ---------------------------------------------------------------------------
  11230. 341. equality 
  11231. Submitter: Andrew Tolmach (apt@princeton.edu)
  11232. Date: 4/17/91
  11233. Version: 0.68
  11234. Severity: major
  11235. Problem: not consistent about allowing equality
  11236. Transcript: 
  11237.   Standard ML of New Jersey, Version 0.69, 3 April 1991
  11238.   val it = () : unit
  11239.   - datatype 'a A = A of 'a ref;
  11240.   datatype 'a  A
  11241.   con A : 'a ref -> 'a A
  11242.   - val f = fn () => ();
  11243.   val f = fn : unit -> unit
  11244.   - val f1 = fn () => ();
  11245.   val f1 = fn : unit -> unit
  11246.   - f = f1;
  11247.   std_in:5.1-5.6 Error: operator and operand don't agree (equality type required)
  11248.     operator domain: ''Z * ''Z
  11249.     operand:         (unit -> unit) * (unit -> unit)
  11250.     in expression:
  11251.       Initial.General.Initial.= (f,f1)
  11252.   - ref f = ref f1;
  11253.   val it = false : bool
  11254.   - ref 2 = ref 2;
  11255.   val it = false : bool
  11256.   - A (ref f) = A (ref f1);
  11257.   std_in:3.1-3.22 Error: operator and operand don't agree (equality type required)
  11258.     operator domain: ''Z * ''Z
  11259.     operand:         (unit -> unit) A * (unit -> unit) A
  11260.     in expression:
  11261.       Initial.General.Initial.= (A (<exp> <exp>),A (<exp> <exp>))
  11262.   - A (ref 2) = A (ref 2);
  11263.   val it = false : bool
  11264.   -
  11265. Comments: 
  11266. If I can compare ref f with ref f1, why can't I compare A(ref f) with 
  11267. A(ref f1)?  Is this a bug or a feature?
  11268. Also, from Chet Murthy:
  11269. I want to define a datatype, with constructors/destructors, for which
  11270. the system can be forced to not provide an equality.  I do not think
  11271. this is possible.  Here is the application:
  11272.  
  11273. The Nuprl term-type is one for which constructors/destructors are
  11274. crucial.  But the term-type is defined in such a way that alpha-equal
  11275. variants are not represented identically.  So lambda(x.x) and
  11276. lambda(y.y) are not the same structure.  So structural equality will
  11277. fail on them.
  11278.  
  11279. So we define alpha-equality, which respects this equivalence.  But the
  11280. problem is that we do not want to discard structural equality
  11281. completely.  That is, if we were to add a new disjunct to the Nuprl
  11282. term-type:
  11283.  
  11284. datatype Term = .......... | Bogus of int -> int
  11285.  
  11286. then Term would not be an eq-type, and structural equality would be
  11287. inadmissible.  But sometimes I DO want structural equality, like in
  11288. hash-consing (and I'm not sure where else, but I don't want to rule
  11289. that out).  So I don't want to give it up right now.  So it would be
  11290. nice to define a structure which exported a datatype for the
  11291. term-type, an equality function which happened to be defined as
  11292. structural equality, but in which the term-type was NOT an eqtype.  Is
  11293. this possible?
  11294.  
  11295. Here is my try - and the problem:
  11296.  
  11297. signature ASIG = sig
  11298. type t
  11299. datatype DNE = D of int | Bogus of t
  11300. val op == : DNE * DNE -> bool
  11301. infix 4 ==
  11302. end;
  11303.  
  11304. abstraction A:ASIG = struct
  11305. type t = int
  11306. datatype DNE = D of int | Bogus of t
  11307. fun == (a,b) = (a = b)
  11308. end;
  11309.  
  11310. If I run (A.D 5)=(A.D 6) the system will happily run it.  But I want
  11311. the system to complain about DNE not being an eq-type.
  11312.  
  11313. This isn't possible, is it?
  11314.  
  11315. Status: not a bug (language problem, see Gunter,Gunter,MacQueen)
  11316. ---------------------------------------------------------------------------
  11317. 342. execute destroys the unix-environment
  11318. Submitter: 
  11319.     Juergen Buntrock,
  11320.     TU-Berlin,
  11321.     jubu@cs.tu-berlin.de
  11322. Date: Fri Dec 21 16:12:49 MET 1990
  11323. Version: Standard ML of New Jersey, Version 0.66, 15 September 1990
  11324. System: Sun 4/60, 16Mbytes, SunOS Release 4.1
  11325. Problem:
  11326. The function execute destroys the unix-environment
  11327.  
  11328. Transcript:
  11329.  
  11330. Script started on Fri Dec 21 16:07:27 1990
  11331. jubu@flp ml66/src 1) ./sml
  11332. Standard ML of New Jersey, Version 0.66, 15 September 1990
  11333. - val (istr,ostr) = execute "/bin/sh";
  11334. - outputc ostr "echo '>'$DISPLAY'<'";
  11335. val it = () : unit
  11336. - close_out ostr;
  11337. val it = () : unit
  11338. -  inputc istr (can_input istr);
  11339. val it = ">flp:0.0\220<\n" : string
  11340.                   ^^^^
  11341. Comments:
  11342. cfuns.c line 1100:
  11343.  
  11344. The c-function exec has to add 0-bytes to the ml-strings.
  11345.  
  11346. Fix:
  11347. A simple fix can be done in perv.sml:
  11348.  
  11349. perv.sml line 953:
  11350. fun execute cmd = let
  11351.     fun add_0byte x = x^"\000\000
  11352.     val (fdin, fdout) = exec
  11353.         (c_string cmd, [], List.map add_0byte(environ()))
  11354.  
  11355.         handle (SysError(_,msg)) => error("execute", cmd, msg)
  11356.         .
  11357.         .
  11358. [jgm]
  11359. Trying this on the SGI produces the following:
  11360.   Uncaught exception Io with "output "<std_out>": write failed, Broken pipe"
  11361. Status: fixed in 0.74 (JHR)
  11362. ---------------------------------------------------------------------------
  11363. 343.
  11364. Submitter:      Ryan Stansifer ryan@cs.purdue.edu
  11365. Date:           May 11, 1991
  11366. Version:        0.66
  11367. Severity:       minor
  11368. Problem:        wrong error message in non-gen exc bindings
  11369. Transcript:
  11370.  
  11371. Standard ML of New Jersey, Version 0.66, 15 September 1990
  11372. val it = () : unit
  11373. - exception e;
  11374. exception e
  11375. - val e' = e
  11376. - exception e'' = e;
  11377. exception e'' = e
  11378. - raise e'';
  11379.  
  11380. uncaught exception e
  11381. - e';
  11382. val it = exn : exn
  11383. - e'';
  11384. val it = exn : exn
  11385. - exception f = e';
  11386. std_in:3.15-3.16 Error: unbound exn: e'
  11387. - exception f = e'';
  11388. exception f = e''
  11389.  
  11390. Status: not a bug; perhaps the error message could be improved to indicate
  11391. that e' is just a value, not a constructor
  11392. ---------------------------------------------------------------------------
  11393. 344. explicit type variable problem
  11394. Submitter: Dave MacQueen (dbm@research.att.com)
  11395. Date: Mar 30 1991
  11396. Version: through 0.74
  11397. Code: 
  11398. structure C : sig val f : 'a -> 'a end =
  11399. struct
  11400.  
  11401.   exception E
  11402.   fun foo(k:'a option -> 'a) : 'a = k(NONE)
  11403.   fun bar(x:'a option) (y: 'a) = raise E
  11404.  
  11405.   fun f (e) =  (* using (e:'a) as argument works *)
  11406.       foo (fn l => let fun g (x : 'a) = bar l x
  11407.             in g e
  11408.            end)
  11409.  
  11410. end
  11411. Comments: 
  11412. The rule for "scoping" explicit type variables like the 'a that
  11413. appears in the definition of g is purely syntactic (i.e. doesn't
  11414. take type checking, and its associated unifications, into account).
  11415. Each explicit type variable is associated with with a particular
  11416. val/fun declaration, and it should be generalized at that declaration,
  11417. if possible.  In this case 'a is associated with the "fun g" declaration,
  11418. and we might annotate the definition of f accordingly:
  11419.  
  11420.   fun f (e) =  (* using (e:'a) as argument works *)
  11421.       foo (fn l => let fun{'a} g (x : 'a) = bar l x
  11422.             in g e
  11423.            end)
  11424.  
  11425. This means that the only legal place to generalize 'a would be at the
  11426. definition of g.  However, in this case the expression "bar l x"
  11427. forces the type of l to be 'a option, meaning that 'a occurs in
  11428. the type of the outer lambda bound variable l.  This prevents the
  11429. generalization of 'a at "fun g", so there is a conflict.  Thus the
  11430. program is not legal, but there should have been an error message
  11431. about not being able to generalize 'a at "fun g", where it is
  11432. syntactically scoped.  I'll put in a fix to detect this situation
  11433. and generate such an error message.
  11434.  
  11435. Status: fixed in 0.85
  11436. ---------------------------------------------------------------------------
  11437. 345. export should return a code and have different type
  11438. Date: Nov 8, 1990
  11439. Severity: minor
  11440. Problem: 
  11441. How come exportFn is string * (string list * string list -> unit) -> unit
  11442. instead of string * (string list * string list -> int) -> 'a   ?
  11443.  
  11444. I was actually suggesting two things: the function passed as
  11445. argument to exportFn should return an exit status and
  11446. exportFn itself should "return" 'a rather than unit
  11447. because it doesn't return.
  11448.  
  11449. Of course, making exportFn's argument return exit status
  11450. might break existing programs that use it; I don't know whether
  11451. that's important or not at this stage of the game.
  11452.  
  11453. If you want to write unix commands in ML, it's important to
  11454. be able to set a return code.
  11455.  
  11456. Comments: there is, of course, an "exit" function available for this purpose.
  11457.  
  11458. Status: suggestion (not a bug)
  11459. ---------------------------------------------------------------------------
  11460. 346. exportFn
  11461. Submitter: 
  11462.     Juergen Buntrock,
  11463.     TU-Berlin,
  11464.     jubu@cs.tu-berlin.de
  11465. Date: Mon Apr  8 15:52:46 MET DST 1991
  11466. Version: Standard ML of New Jersey, Version 0.66, 15 September 1990 
  11467. System: Sun3-260 / SunOS Release 4.0.3_Export 
  11468.     Sun4-370 / SunOS Release 4.1.1
  11469. Messages:
  11470.     Warning: can't increase heap
  11471.     Ran out of memory
  11472. Comments:
  11473.     After an exportFn two pointers in Core.Refs are invalid.
  11474.     The addresses of
  11475.     (!Core.Refs.getDebugf)
  11476.     and (!Core.Refs.debugInterface)
  11477.     are bigger then (arenabase+arenasize) !
  11478.     After an increase_heapsize the gc will collect
  11479.     some random-object.
  11480. Bug Fix :
  11481.     change the type of
  11482.     Core.Refs.getDebugf and Core.Refs.debugInterface
  11483.     to (unit->unit) ref. (in file boot/core.sml)
  11484.     := will the do an boxed-update!
  11485. Status: fixed in 0.84
  11486. ---------------------------------------------------------------------------
  11487. 347. dec function in fastlib wrong
  11488. Submitter: Andrew Appel (appel@princeton.edu)
  11489. Date: Apr 15 1991
  11490. Version: 0.69 (and all previous)
  11491. Severity: major
  11492. Problem: 
  11493. In all versions up to and including 0.69, the "dec" function (decrement)
  11494. in boot/fastlib.sml was wrong (it incremented).  This will affect only
  11495. those users who followed the hints for faster performance in the
  11496. doc/ directory, which explained how to include Fastlib in one's programs.
  11497. Unfortunately, I am such a user.  What a waste of time. 
  11498. Status: fixed in 0.70
  11499. ---------------------------------------------------------------------------
  11500. 348. connect_inet bug 
  11501. Submitter: John Reppy (jhr@cs.cornell.edu)
  11502. Date: Mar 23 1991
  11503. Version: 0.68
  11504. Severity: minor
  11505. Fix: 
  11506. If you haven't already built 0.69, then please include the following
  11507. bug fix for connect_inet in runtime/cfuns.c:
  11508.  
  11509. line 258, which is:
  11510.  
  11511.       saddr.sin_port = atoi(port);
  11512.  
  11513. should be replaced with
  11514.  
  11515.       saddr.sin_port = htons(atoi(port));
  11516.  
  11517. and line 266, which is:
  11518.  
  11519.         saddr.sin_addr.s_addr = s;
  11520.  
  11521. should be replaced with
  11522.  
  11523.     saddr.sin_addr.s_addr = htonl(s);
  11524. Status: Fixed.
  11525. ---------------------------------------------------------------------------
  11526. 349. function names in FUN not checked for uniqueness
  11527. Submitter:      Andrzej Filinski <andrzej@cs.cmu.edu>
  11528. Date:        June 5, 1991
  11529. Version:        0.67
  11530. System:         All
  11531. Severity:       Minor
  11532. Problem:        Function names in FUN not checked for uniqueness
  11533. Code:           fun foo x = 3 and foo x = true
  11534. Transcript:     - fun foo x = 3 and foo x = true;
  11535.         val foo = fn : 'a -> int
  11536.         val foo = fn : 'a -> bool
  11537.         -
  11538. Comments: The equivalent VAL REC declaration is correctly rejected.
  11539. Also, from Olof Johansson (olof@cs.umu.se)
  11540. Is this a bug? What is the point of the definition?
  11541. Is it allowed to do this according to the definition of SML?
  11542.  
  11543.     Standard ML of New Jersey, Version 0.66, 15 September 1990
  11544.     val it = () : unit
  11545.     - datatype F = C and F = D;
  11546.     datatype  F
  11547.     con C : F
  11548.     datatype  F
  11549.     con D : F
  11550.     - D;
  11551. >    val it = D : F
  11552.     - C;
  11553. >    val it = D : F
  11554.  
  11555. Which one of the following response is the correct one.
  11556. Should they not be the same?
  11557.  
  11558.     Standard ML of New Jersey, Version 0.66, 15 September 1990
  11559.     val it = () : unit
  11560.     - val rec f = fn x => 1 and f = fn y => 2;
  11561.     std_in:2.9-2.39 Error: duplicate function name in val rec dec: f
  11562.     - fun f x = 1 and f y = 2;
  11563.     val f = fn : 'a -> int
  11564.     val f = fn : 'a -> int
  11565.     - f 0;
  11566.     val it = 2 : int
  11567.  
  11568. Olof Johansson
  11569.  
  11570. Fix:        Add checkUniq of function names to makeFUNdec in 
  11571.            parse/corelang.sml or to FUNdec in absyn/absyn.sml
  11572. Status: fixed in 0.71
  11573. ---------------------------------------------------------------------------
  11574. 350. fvalbind rewrite rule
  11575. Submitter: Nick Rothwell (nick@lfcs.edinburgh.ac.uk)
  11576. Date: 12 Feb 1991
  11577. Version: 
  11578. System: 
  11579. Severity: minor
  11580. Problem: 
  11581. Referring to the definition of the `fun' derived form (defn. V4 p68):
  11582. there's a rewriting rule for fvalbind's looking like
  11583.  
  11584.           <op>var atpat.11 ... atpat.1n <: ty> = exp.1
  11585.           <op>var atpat.21 ... atpat.2n <: ty> = exp.2
  11586.  
  11587.           <op>var atpat.m1 ... atpat.mn <: ty> = exp.m
  11588.                 <and fvalbind>
  11589.  
  11590. This implicitly suggests that all the function result type constraints
  11591. (whichever present) have to be the same. But, this is a *syntactic*
  11592. constraint (we're dealing with derived forms, not elaboration rules).
  11593. Certainly they have to elaborate to the same type, but surely they may be
  11594. distinct syntactically? The above rule outlaws the following
  11595.  
  11596.         local
  11597.           type INT = int
  11598.         in
  11599.           fun f 0 : int = 0
  11600.             | f 1 : INT = 1
  11601.         end;
  11602. Code: 
  11603. Transcript: 
  11604. Comments: Appel says: the Def'n should have subscripts on the ty's, and
  11605.              that's obviously what is meant here.
  11606. Fix: 
  11607. Status: not a bug?
  11608. ---------------------------------------------------------------------------
  11609. 351. gc messages bug
  11610. Submitter: Andrew Tolmach (apt@princeton.edu)
  11611. Date: 7 May 1991
  11612. Version: 0.69 (and some earlier, 68 based versions)
  11613. System: mipsb
  11614. Severity: minor
  11615. Problem: 
  11616. In version 69 (and some earlier, 68 based versions) on mipsb,
  11617. the unsafe gc primitive interacts badly with gcmessages.  
  11618. Obviously this isn't a serious problem in itself, but maybe bears loking
  11619. into...?
  11620. Code: 
  11621. Transcript: 
  11622. - val gc = System.Unsafe.CInterface.gc;
  11623. val gc = fn : int -> unit
  11624. - (gc 0; gc 0);
  11625. val it = () : unit
  11626. - System.Control.Runtime.gcmessages := 3;
  11627. val it = () : unit
  11628. - (gc 0; gc 0);
  11629.  
  11630. [Minor collection... 0% used (2224/765756), 10 msec]
  11631.  
  11632. [Minor collection...bogus signal in ML: (5, 0x7)
  11633. Comments: 
  11634. Fix: 
  11635. Status: should be fixed in 0.70
  11636. ---------------------------------------------------------------------------
  11637. 352. gc statistics bug
  11638. Submitter: Greg Morrisett (jgmorris@cs.cmu.edu)
  11639. Date: June 25, 1991
  11640. Version: 0.69
  11641. System: All
  11642. Severity: minor
  11643. Problem: 
  11644. In callgc.c, there's a couple of places where you're trying to
  11645. bump an ML_val_t int ref (e.g. majorcollections, collected, etc.)
  11646. and using code like this:
  11647.  
  11648.            minorcollections += 2;
  11649.  
  11650. But since ML_val_t is an unsigned int pointer, this bumps the
  11651. value by 4 (i.e. ML 2).  The safe way to add to an ML_val_t is
  11652. to use INT_incr.
  11653. Code: 
  11654. Transcript: 
  11655. Comments: 
  11656. Fix: 
  11657. change line 217 of callgc.c to read
  11658.           minorcollections = INT_incr(minorcollections,1);
  11659. change lines 292-294 of callgc.c to read
  11660.           collected = INT_incr(collected, ((a+512)/1024));
  11661.       collectedfrom = INT_incr(collectedfom, ((b+512)/1024));
  11662.           majorcollections = INT_incr(majorcollections,1);
  11663. Status: should be fixed in 0.70
  11664. ---------------------------------------------------------------------------
  11665. 353. getWD can't get above mount points on NeXT
  11666. Submitter: John Reppy (jhr@cs.cornell.edu)
  11667. Date: Jun 7 1991
  11668. Version: 0.69
  11669. System: NeXT
  11670. Severity: minor
  11671. Problem: 
  11672. System.Directory.getWD doesn't seem to be able to get above mount
  11673. points on the NeXT (works on the sun).  E.g.,
  11674. Code: 
  11675. Transcript: 
  11676.   <jhr@alvis:57> pwd
  11677.   /usr/fsys/loki/b/jhr
  11678.   <jhr@alvis:58> sml
  11679.   Standard ML of New Jersey, Version 0.69, 3 April 1991
  11680.   val it = () : unit
  11681.   - System.Directory.cd ".."; 
  11682.   val it = () : unit
  11683.   - System.Directory.getWD();
  11684.   val it = "/" : string
  11685.   - System.Directory.cd ".."; 
  11686.   val it = () : unit
  11687.   - System.Directory.getWD();
  11688.   val it = "/usr/fsys/loki" : string
  11689. Comment:
  11690.   See also 421.
  11691.   To be fixed by calling C version of getWD (after new gc allows malloc).
  11692. Status: open
  11693. ---------------------------------------------------------------------------
  11694. 354. SIGILL bug on SPARC
  11695. Submitter: John Reppy (jhr@cs.cornell.edu)
  11696. Date: June 18 1991
  11697. Version: 0.69
  11698. System: SPARC
  11699. Severity: major
  11700. Problem: 
  11701. One of our alpha testers encountered a strange Overflow exception in
  11702. eXene.  Upon closer examination it turns out that the problem really
  11703. is an illegal instruction exception (SIGILL), and that modifications
  11704. made to support MACH on the SPARC caused SIGILL to be mapped to Overflow.
  11705.  
  11706. Further examination demonstrates that the bug is neither an eXene bug
  11707. or CML bug, but is a bug in SML/NJ.  After a lot of testing I've managed
  11708. to produce a small (<100 lines) example program, which will cause the
  11709. bug on both the SPARC and DECstation 3100.  The fact that this program
  11710. uses the timer interrupts to do thread switching is key; if you turn
  11711. the signals off, then the bug does not appear.  I also note that the bug
  11712. does not seem to appear in my version of 0.68 (0.67 + my changes for
  11713. the unsafe callcc); thus I suspect that it was introduced by the
  11714. changes made for supporting FP registers.  The example program is
  11715. included below; to produce the bug, run the function "go."  It usually
  11716. takes about 3-5 minutes to fail on a SPARCstation-1.  For example, the
  11717. following run took 2.5 min:
  11718.  
  11719.   Standard ML of New Jersey, Version 0.69, 3 April 1991
  11720.   val it = () : unit
  11721.   - use "sml-bug.sml";
  11722.   [opening sml-bug.sml]
  11723.   val yield = fn : unit -> unit
  11724.   val spawn = fn : string * (unit -> unit) -> unit
  11725.   val doit = fn : (unit -> unit) -> unit
  11726.   val go = fn : unit -> unit
  11727.   [closing sml-bug.sml]
  11728.   val it = () : unit
  11729.   - go();
  11730.   initial process
  11731.   proc1
  11732.   proc2
  11733.   proc1: uncaught exception Overflow
  11734.   initial process: uncaught exception Overflow
  11735.   val it = () : unit
  11736. Code: 
  11737.   (see John's CML code)
  11738. Status: Fixed in 0.70
  11739. ---------------------------------------------------------------------------
  11740. 355. incorrect line numbers with import
  11741. Submitter: deutsch@poly.polytechnique.fr.
  11742.    Alain Deutsch,
  11743.    Laboratoire d'Informatique de l'Ecole Polytechnique (LIX)
  11744.    91128 Palaiseau Cedex
  11745.    France.
  11746. Date: Thu Nov 22 14:35:09 MET 1990
  11747. Version: Version 0.66
  11748. System: SUN3/60
  11749. Severity: minor
  11750.  
  11751. Problem: Incorrect line/column numbers when compiling a module w. import,
  11752.  although the numbers are correct when compiling with use.
  11753.  
  11754. Transcript:
  11755.  
  11756.  Standard ML of New Jersey, Version 0.66, 15 September 1990
  11757.  val it = () : unit
  11758.  
  11759.  - use "ExampleFunctor.sml";
  11760.  [opening ExampleFunctor.sml]
  11761.  ExampleFunctor.sml:3.9-3.18 Warning: match not exhaustive
  11762.      x :: nil => ...
  11763.  functor F : <sig>
  11764.  [closing ExampleFunctor.sml]
  11765.  val it = () : unit
  11766.  
  11767.  - import "ExampleFunctor";
  11768.  [reading ExampleFunctor.sml]
  11769.  ExampleFunctor.sml:0.0-0.0 Warning: match not exhaustive
  11770.      x :: nil => ...
  11771.  [writing ExampleFunctor.bin... done]
  11772.  [closing ExampleFunctor.sml]
  11773.  functor F
  11774.  - 
  11775. Status: Fixed (Defunct feature)
  11776. ---------------------------------------------------------------------------
  11777. 356. size of images generated by import too large
  11778. Submitter: Jawahar Malhotra (malhotra%metasoft@bbn.com)
  11779. Date: Jan 29, 1991
  11780. Version: 
  11781. System: 
  11782. Severity: 
  11783. Problem: 
  11784. I recently redesigned a large system so that I could use separate
  11785. compilation. I experienced an increase in heap size of
  11786. close to 100%. This was a little disturbing and so I investigated
  11787. a little. To explain the problem consider the following example:
  11788.  
  11789. Say my system consists of 4 modules: A, B, C, D. 
  11790. Every functor is in a separate file as is every signature.
  11791. To link, I execute 'use "link.sml"'.
  11792.  
  11793. ++++++++++++++++++++++++++++++
  11794. (* link.sml *)
  11795.  
  11796. import "a";
  11797. import "b";
  11798. import "c";
  11799. import "d";
  11800.  
  11801. structure A = A();
  11802. structure B = B(A);
  11803. structure C = C(A);
  11804. structure D = D(structure X = B
  11805.         structure Y = C);
  11806. ++++++++++++++++++++++++++++++
  11807.  
  11808. The files are as follows:
  11809.  
  11810. ++++++++++++++++++++++++++++++
  11811. (* a.sml *)
  11812.  
  11813. import "a.sig";
  11814.  
  11815. functor A() = 
  11816. ...
  11817. ++++++++++++++++++++++++++++++
  11818.  
  11819. ++++++++++++++++++++++++++++++
  11820. (* b.sml *)
  11821.  
  11822. import "a.sig";
  11823. import "b.sig";
  11824.  
  11825. functor B (X:ASIG) : BSIG = 
  11826. ...
  11827. ++++++++++++++++++++++++++++++
  11828.  
  11829. ++++++++++++++++++++++++++++++
  11830. (* c.sml *)
  11831.  
  11832. import "a.sig";
  11833. import "c.sig";
  11834.  
  11835. functor C (X:ASIG) : CSIG = 
  11836. ...
  11837. ++++++++++++++++++++++++++++++
  11838.  
  11839. ...
  11840.  
  11841. Building the system as shown above led to LARGE heap sizes (and images
  11842. generated by exportML). I suspected that this was due to the
  11843. duplicated imports of the same signature file by many sml files.  
  11844. For example, "a.sig" is imported by "a.sml", "b.sml", "c.sml". 
  11845.  
  11846. To verify this, I wrote a function called "smartImport" which uses
  11847. "use" to load files. It maintains an environment of files already
  11848. loaded and avoids duplicate loading of files (code appears at end of
  11849. message). I then replaced "import" by "smartImport" in all my source
  11850. files and rebuilt. I found that the resulting image size was much
  11851. smaller. 
  11852.  
  11853. The following results were obtained using an actual system with
  11854. approx. 40 modules. For both cases, exactly the same source code was
  11855. loaded and an image exported using "exportML".
  11856.  
  11857. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  11858.                         exportML file size
  11859.                             (bytes)
  11860.  
  11861. Without smartImport (regular sep. comp.)    5799968
  11862. With smartImport                 3063840
  11863. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  11864.  
  11865. This is quite a significant saving. I would eventually like to have an
  11866. improved "import" command; one that can avoid duplicated loading of files.
  11867. I'm not so sure the technique I have used (i.e. using file names to
  11868. determine if a file has already been loaded) is a general error-free
  11869. solution.
  11870.  
  11871. A combination of file name and file modification time may be better.
  11872. So whenever "import" loads a file, it records the file name and the
  11873. file modification time. The next time it encounters this file, it
  11874. compares the saved modification time with the file's actual
  11875. modification time. If the file is newer, it reloads the file else it
  11876. skips the file. 
  11877.  
  11878. Has anyone else had such experiences with separate compilation? Any
  11879. other suggestions for how to keep the heap size down?
  11880.  
  11881. Jawahar
  11882. Comments: 
  11883. [jgm]
  11884. Gene Rollin's sourcegroup stuff is being designed to take care of
  11885. this problem.
  11886. Status: Fixed (defunct feature)
  11887. ---------------------------------------------------------------------------
  11888. 357. import broken
  11889. Submitter:      Richard O'Neill (rmo@sys.uea.ac.uk)
  11890. Date:        Tue Nov 13 10:44:42 GMT 1990
  11891. Version:        0.67 (not in 0.66)
  11892. System:         Sun4/SunOS 4.1 (probably irrelevant)
  11893. Severity:       Major
  11894. Problem:        
  11895.  
  11896. Version 0.67 of Standard ML of New Jersey breaks 'import'. Import now seems
  11897. to compile the file it is given but fails to introduce the declarations
  11898. from that file into the environment.
  11899.  
  11900. Transcript: 
  11901.  
  11902. unix% cat > example.sml
  11903. signature Test = sig type foobar end
  11904. unix% sml
  11905. Standard ML of New Jersey, Version 0.67, 21 November 1990
  11906. val it = () : unit
  11907. - import "example";
  11908. [reading example.sml]
  11909. [writing example.bin... done]
  11910. [closing example.sml]
  11911. signature Test
  11912. - signature CopyOfTest = Test;
  11913. std_in:3.24-3.27 Error: unbound signature: Test
  11914. -
  11915.  
  11916. Comments: (guesses)
  11917.  
  11918. Looking at differences between 0.66 & 0.67 I see that the way the environment
  11919. is handled has changed. I suspect that this has something to do with it.
  11920.  
  11921. Other information:
  11922.  
  11923. The version I have built was made from the mo.sparc files and src from 
  11924. 'pub/ml/working' at princeton.
  11925. Status: fixed (as of 0.69 anyway)
  11926. ---------------------------------------------------------------------------
  11927. 358. import & pervasives
  11928. Submitter:      Elsa Gunter elsa@research.att.com
  11929. Date:        27 March 1991
  11930. Version:        0.68
  11931. System:         mips
  11932. Problem:        import doesn't always get the pervasive types right
  11933. Code:           
  11934.  
  11935. (* File: bug.sig.sml *)
  11936.  
  11937. signature ASig =
  11938. sig
  11939. exception FOO of string
  11940. end
  11941.  
  11942. (* File: bug.sml *)
  11943.  
  11944. import "bug.sig";
  11945.  
  11946. functor AFunc () =
  11947. struct 
  11948. exception FOO of string
  11949. end
  11950.  
  11951.  
  11952. Transcript:
  11953.  
  11954. Standard ML of New Jersey, Version 0.68, March 7, 1991
  11955. val it = () : unit
  11956. - import "bug.sig";
  11957. [reading bug.sig.sml]
  11958. [writing bug.sig.bin... done]
  11959. [closing bug.sig.sml]
  11960. signature ASig
  11961. - import "bug";
  11962. [reading bug.sml]
  11963.   [reading bug.sig.bin... done]
  11964. bug.sml:5.18-5.23 Error: unbound type constructor: string
  11965. import: syntax or semantic error
  11966. [closing bug.sml]
  11967. IMPORT failed
  11968. -  
  11969.  
  11970.  
  11971. Standard ML of New Jersey, Version 0.68, March 7, 1991
  11972. val it = () : unit
  11973. - import "bug";
  11974. [reading bug.sml]
  11975.   [reading bug.sig.sml]
  11976.   [writing bug.sig.bin... done]
  11977.   [closing bug.sig.sml]
  11978. [writing bug.bin... done]
  11979. [closing bug.sml]
  11980. signature ASig
  11981. functor AFunc
  11982. - import "bug";
  11983. [reading bug.bin... ]
  11984. [import(s) of bug are out of date; recompiling]
  11985. [closing bug.bin]
  11986. [reading bug.sml]
  11987.   [reading bug.sig.bin... done]
  11988. bug.sml:5.18-5.23 Error: unbound type constructor: string
  11989. import: syntax or semantic error
  11990. [closing bug.sml]
  11991. IMPORT failed
  11992. Status: Fixed (as of 0.69)
  11993. ---------------------------------------------------------------------------
  11994. 359. indexing 
  11995. Submitter:      Gene Rollins <rollins@cs.cmu.edu>
  11996. Date:        Mar 11, 1991
  11997. Version:        0.67
  11998. Severity:       minor
  11999. Problem:        Indexing code doesn't handle all abstract syntax trees
  12000. Code:           Anything with an import clause in it.
  12001. Transcript:     Error: Compiler bug: Index2
  12002. Comments:       Only happens when (!System.Control.indexing) = true
  12003. Fix:
  12004.  
  12005. In file build/index.sml, add three clauses for printDec, and eliminate
  12006. the final wildcard clause.
  12007.  
  12008. diff {old,new}/build/index.sml
  12009. 160a161,162
  12010. >       | printDec(FIXdec _) = ()
  12011. >       | printDec(OVLDdec _) = ()
  12012. 161a164
  12013. >       | printDec(IMPORTdec _) = ()
  12014. 163d165
  12015. <       | printDec _ = ErrorMsg.impossible "Index2"
  12016. Comment:  Import will soon go away.  Then this will be "not a bug".
  12017. Status: fixed in 0.71
  12018. ---------------------------------------------------------------------------
  12019. 360. bad error message when missing functor argument
  12020. Submitter: Robert Harper (rwh@cs.cmu.edu)
  12021. Date: Aug 29 1990
  12022. Version: 
  12023. System: 
  12024. Severity: minor
  12025. Problem: 
  12026.     Here's another bug report, this one relatively minor.  The problem
  12027. arises as follows.  I have a build file which imports a bunch of files and
  12028. then applies a bunch of functors to build the program.  I changed one of the
  12029. functors to take a parameter where it formerly had none.  But I forgot to
  12030. change the build file to plug in an argument.  Here's what I get:
  12031.  
  12032. /usr/rwh/courses/ic90/build.sml:56.5-56.10 Error: unmatched structure spec:
  12033. Type
  12034. Error: Compiler bug: inststr NULLstr
  12035. [closing /usr/rwh/courses/ic90/build.sml]
  12036.  
  12037. It gives a reasonable message, then an unreasonable one.  I've noticed
  12038. versions of this where the "compiler bug" is "tyC" (or something close to
  12039. that).
  12040.  
  12041. My suspicion is that it has to do with the awful declaration-as-argument
  12042. syntax for functor applications ....
  12043. Code: 
  12044. Transcript: 
  12045. Comments: 
  12046. Fix: 
  12047. Status: probably fixed in 0.73, but can't tell (no source provided)
  12048. ---------------------------------------------------------------------------
  12049. 361. Error: Compiler bug: Functor.applyFunctor.insttyc
  12050. Submitter:      Elsa elsa@research.att.com
  12051. Date:        8 March 1991
  12052. Version:        0.66 & 0.67
  12053. System:         mips mips and Sun3 with SunOS 4.0
  12054. Problem:        Error: Compiler bug: Functor.applyFunctor.insttyc
  12055. Code:
  12056. Status: R
  12057.  
  12058. signature AA =
  12059.     sig
  12060.     datatype s  =  a of s
  12061. end  (* signature AA *)
  12062.  
  12063. signature BB =
  12064.     sig
  12065.     structure A : AA
  12066. end  (* signature BB *)
  12067.  
  12068.  
  12069. signature CC =
  12070.     sig
  12071.     structure B : BB
  12072.     type v
  12073. end  (* signature CC *)
  12074.  
  12075. functor F (structure B : BB) : CC =
  12076.     struct
  12077.     structure B = B
  12078.     structure A = B.A
  12079.     open A
  12080.     type u = s
  12081.     end (* functor F *)
  12082.  
  12083. structure C : CC = F (structure B = B);
  12084.  
  12085. Transcript:
  12086.  
  12087. - use "bug2.sml";
  12088. [opening bug2.sml]
  12089. bug2.sml:19.5-24.7 Error: unmatched type spec: v
  12090. bug2.sml:26.37 Error: unbound structure name: B
  12091. bug2.sml:26.20 Error: unmatched structure spec: A
  12092. insttyc: NULLtyc
  12093. Error: Compiler bug: Functor.applyFunctor.insttyc
  12094. [closing bug2.sml]
  12095. Status: fixed in 0.73
  12096. ---------------------------------------------------------------------------
  12097. 362. missing primop in interp
  12098. Submitter: John Reppy (jhr@cs.cornell.edu)
  12099. Date: Jan 17 1991
  12100. Version: 0.67
  12101. System: 
  12102. Severity: 
  12103. Problem: 
  12104. Code: 
  12105. Transcript: 
  12106.   Standard ML of New Jersey, Version 0.67, 21 November 1990
  12107.   val it = () : unit
  12108.   - System.Control.interp := true;
  12109.   val it = () : unit
  12110.   - fun f x = Bits.notb x;
  12111.   Error: Compiler bug: bad primop in interp
  12112. Comments: 
  12113. Fix: 
  12114. Status: fixed (as of 0.69)
  12115. ---------------------------------------------------------------------------
  12116. 363. bug in 0.69 interpreter
  12117. Submitter: John Reppy (jhr@cs.cornell.edu)
  12118. Date: June 17 1991
  12119. Version: 0.69
  12120. System: 
  12121. Severity: 
  12122. Problem: 
  12123. Code: 
  12124. Transcript: 
  12125.   Standard ML of New Jersey, Version 0.69, 3 April 1991
  12126.   val it = () : unit
  12127.   - app (fn x => x) ["abc", "def"];
  12128.   val it = () : unit
  12129.   - System.Control.interp := true;
  12130.   val it = () : unit
  12131.   - app (fn x => x) ["abc", "def"];
  12132.  
  12133.   uncaught exception Match
  12134.   - 
  12135. Comments: First fix the saving of lambda in interact.sml.
  12136. Fix: 
  12137. Status: fixed in 0.70
  12138. ---------------------------------------------------------------------------
  12139. 364. bug in lexgen doc
  12140. Submitter: John Reppy (jhr@cs.cornell.edu)
  12141. Date: June 5 1991
  12142. Version: 
  12143. System: 
  12144. Severity: minor
  12145. Problem: 
  12146. The example of how to build a lexer is wrong (line 348), because the
  12147. input file gets opened multiple times.
  12148.  
  12149.         val lexer = Mlex.makeLexer (fn x => input(open_in "f",x))
  12150.  
  12151. should be
  12152.  
  12153.         val lexer = Mlex.makeLexer (inputc (open_in "f"))
  12154.  
  12155. This has confused at least one naive user.
  12156. Code: 
  12157. Transcript: 
  12158. Comments: 
  12159. [jgm] according to Dave Tarditi, this has been fixed in the
  12160. latest copy of the documentation.
  12161. Fix: 
  12162. Status: fixed in 0.70
  12163. ---------------------------------------------------------------------------
  12164. 365. fixed size of tuples causes bug
  12165. Submitter:      Jawahar Malhotra
  12166. Date:        29 May 91
  12167. Version:        0.62
  12168. System:         SUN SPARC, SUN OS 4.1
  12169. Severity:       major
  12170. Problem:        A labeled record can have no more than 100 fields
  12171. Comments:
  12172. I was browsing the typechecker code (typing/typecheck.sml) and I
  12173. noticed a constant "val maxFieldNum = 100," which I assume limits
  12174. the number of slots a tuple is allowed to have.  It would be best
  12175. to avoid such hard-coded limits, but, if they must exist, they
  12176. probably should be localized into a single structure, to allow
  12177. easy modifications.
  12178.  
  12179.   - John
  12180.  
  12181. Version 0.69 of SML/NJ:
  12182.  
  12183. When compiling the following code, an "uncaught exception Subscript"
  12184. occurs.  If the number of elements in the tuple is reduced to 100 from
  12185. 110, the exception no longer occurs.
  12186.  
  12187. From: wright@rice.edu (Andrew Wright)
  12188. fun g(f) =
  12189. ( f(), f(), f(), f(), f(), f(), f(), f(), f(), f(),
  12190.   f(), f(), f(), f(), f(), f(), f(), f(), f(), f(),
  12191.   f(), f(), f(), f(), f(), f(), f(), f(), f(), f(),
  12192.   f(), f(), f(), f(), f(), f(), f(), f(), f(), f(),
  12193.   f(), f(), f(), f(), f(), f(), f(), f(), f(), f(),
  12194.   f(), f(), f(), f(), f(), f(), f(), f(), f(), f(),
  12195.   f(), f(), f(), f(), f(), f(), f(), f(), f(), f(),
  12196.   f(), f(), f(), f(), f(), f(), f(), f(), f(), f(),
  12197.   f(), f(), f(), f(), f(), f(), f(), f(), f(), f(),
  12198.   f(), f(), f(), f(), f(), f(), f(), f(), f(), f(),
  12199.   f(), f(), f(), f(), f(), f(), f(), f(), f(), f() );
  12200.  
  12201. Fix:  sort without an array
  12202. Status: fixed in 0.71
  12203. ---------------------------------------------------------------------------
  12204. 366. lookPath bug in 0.56
  12205. Submitter: James Shennan, University of Warwick, Coventry, 
  12206.        CV4 7AL. tel: 0203 523523 
  12207. Date: 29th January 1991
  12208. Version: 0.56
  12209. System: 
  12210. Severity: 
  12211. Problem: 
  12212. The two modules that follow were tested independantly and they both worked.
  12213. The problem comes when they try and communicate. I have cut the modules
  12214. down as much as possible and hope that the exact problem is clear to you
  12215. (as it isn't to me!).
  12216.  
  12217. I've been playing around with the two modules and found that they work okay in
  12218. conjunction with eachother when the datatype node_seq in the NODE_SEQ
  12219. module is not recursive.
  12220. Code: 
  12221. *****************************************************************************
  12222.  This is the Hierarchy structure that uses the sequence structure.
  12223. ******************************************************************************
  12224. import "../sequence/sequence";
  12225. signature HIERARCHY =
  12226.   sig
  12227.     type Sequence
  12228.     datatype Hierarchy = EmptyHierarchy | Addlevel of Sequence * Hierarchy
  12229.   end
  12230.  
  12231. functor Hierarchy(structure Node_Seq : NODE_SEQ) : HIERARCHY =
  12232.   struct
  12233.     type Sequence = Node_Seq.node_seq
  12234.     datatype Hierarchy = EmptyHierarchy | Addlevel of Sequence * Hierarchy
  12235.   end
  12236. ******************************************************************************
  12237. And this is the Node_Sequence structure.
  12238. ******************************************************************************
  12239. import "node";
  12240. signature NODE_SEQ =
  12241.   sig
  12242.     eqtype Element
  12243.     datatype node_seq = NIL | cons of Element * node_seq
  12244.   end
  12245.  
  12246. functor Node_Seq(structure Node : NODE) : NODE_SEQ =
  12247.   struct
  12248.     type Element = Node.tYpe
  12249.     datatype node_seq = NIL | cons of Element * node_seq
  12250.   end
  12251.  
  12252. ****************************************************************************
  12253. This is the file that I 'use' to save typing. I have tried typing it in
  12254. manually as well.
  12255. ****************************************************************************
  12256. import "../hierarchy/hierarchy";
  12257. structure n = Node();
  12258. structure ns = Node_Seq(structure Node = n);
  12259. structure h = Hierarchy( structure Node_Seq = ns);
  12260. open h;
  12261. val seq = ns.cons("hello",ns.NIL);
  12262. val H = Addlevel(ns.NIL,EmptyHierarchy);
  12263. val HH = Addlevel(ns.NIL,H);
  12264. val HHH = Addlevel(seq,HH);
  12265.  
  12266. Transcript:
  12267. Script started on Tue Jan 29 16:57:12 1991
  12268. warning: could not update utmp entry
  12269. njsmlchmod: /dev/ttyp0: Not owner
  12270. Variable syntax.
  12271. emerald> njsml
  12272. Standard ML of New Jersey, Version 0.56, 13 April 1990
  12273. Warning: input and output are now uncurried, arithmetic exceptions
  12274. are re-arranged, div and mod are different; see doc/NEWS
  12275. val it = () : unit
  12276. - use "vars";
  12277. [opening vars]
  12278. [reading ../hierarchy/hierarchy.bin... done]
  12279. signature NODE
  12280. signature HIERARCHY
  12281. signature NODE_SEQ
  12282. functor Node
  12283. functor Hierarchy
  12284. functor Node_Seq
  12285. structure n :
  12286.   sig
  12287.     eqtype tYpe
  12288.   end
  12289. structure ns :
  12290.   sig
  12291.     datatype node_seq
  12292.       con NIL : node_seq
  12293.       con cons : Element * node_seq -> node_seq
  12294.     eqtype Element
  12295.   end
  12296. structure h :
  12297.   sig
  12298.     eqtype Sequence
  12299.     datatype Hierarchy
  12300.       con Addlevel : Sequence * Hierarchy -> Hierarchy
  12301.       con EmptyHierarchy : Hierarchy
  12302.   end
  12303. open h
  12304. val seq = cons (-,NIL) : ns.node_seq
  12305. val H = Addlevel (NIL,EmptyHierarchy) : Hierarchy
  12306. val HH = Addlevel (NIL,Addlevel (NIL,EmptyHierarchy)) : Hierarchy
  12307. val HHH = Addlevel (Error: Compiler bug: EnvAccess.lookPath
  12308. [closing vars]
  12309. - ^Demerald> ^Dexit
  12310. Comments: 
  12311. Fix: Ask the submitter if it still happens in 0.73.
  12312. Status: probably fixed
  12313. ---------------------------------------------------------------------------
  12314. 366. lookahead
  12315. Submitter: Dave Berry <db@lfcs.edinburgh.ac.uk>
  12316. Date: Jan 26 1991
  12317. Version: ?
  12318. Severity: minor
  12319. Problem: 
  12320. If I type the following simple program to either SML/NJ or Poly/ML, I
  12321. get some interesting behaviour:
  12322.  
  12323. (lookahead std_in; lookahead std_in);
  12324.  
  12325. (I haven't tried this with Poplog ML or Edinburgh ML because they're only
  12326. installed on our Suns, which have crashed.)
  12327.  
  12328. If I give this program the input
  12329.  
  12330. a
  12331.  
  12332. it returns the string "a".  This is the behaviour I expect - the first
  12333. call looks at the next character but doesn't affect the state of the
  12334. stream, so the next call finds the same character.
  12335.  
  12336. (If you try this you'll have to type a semi-colon after the program
  12337. finishes, because the compiler will read your input.)
  12338.  
  12339. However, if I give the following input to the program
  12340.  
  12341. <CTRL-D>a
  12342.  
  12343. then it still returns "a".  In other words the first call consumes the
  12344. end-of-stream marker, changing the state of the stream.  It's not at all
  12345. clear to me that this is the desired behaviour.  It's this behaviour
  12346. that results in the problem with end_of_stream that I mentioned some weeks
  12347. ago, because (end_of_stream i) is defined as (lookahead i = "").
  12348.  
  12349. I suggest that lookahead should never change the state of a stream, even
  12350. when it finds an end-of-stream marker on an interactive stream.  This
  12351. may require some extra state information in the implementation of a 
  12352. stream, but that shouldn't be visible to the user.  This would give
  12353. more consistent behaviour, and would solve the problem with end_of_stream.
  12354. It also means that I could get rid of the InStream and OutStream types
  12355. in the Edinburgh library, making it quite a bit simpler to use (and
  12356. maintain).
  12357.  
  12358. Some interactive programs do have to consume end-of-stream markers on
  12359. interactive streams.  This can be done by calling read at the appropriate
  12360. place, perhaps using a function like the following:
  12361.  
  12362. fun consumeEOS i =
  12363.       if InStream.interactive i then
  12364.     if end_of_stream i then read i else ""
  12365.       else raise NotInteractive i;
  12366.  
  12367. The only problem that I can see with this approach is that a program that
  12368. tests for end_of_stream won't necessarily consume the end-of-stream marker
  12369. with an explicit read, which means that the compiler will read it and exit.
  12370. I can think of a couple of ways that an implementation could avoid this.
  12371. The first is to consume an end-of-stream marker before reading a new
  12372. program, thus requiring the user to type CTRL-D twice to exit (which might
  12373. be safer anyway).  The second is to require the user to call a specific
  12374. exit function to exit the compiler.  The third is to treat std_in specially,
  12375. and to mark when an end-of-stream marker is encountered by a user calling
  12376. lookahead as opposed to the compiler calling lookahead.  I don't know
  12377. how easy this would be to implement.
  12378.  
  12379. To summarise, this gives a consistent behaviour to lookahead, and seems a
  12380. far neater way of solving the end_of_stream problem than my previous
  12381. suggestion.
  12382. Status: fixed in 0.71
  12383. ---------------------------------------------------------------------------
  12384. 367. Decstation mach recompolation to m68
  12385. Submitter:      Gene Rollins <rollins@cs.cmu.edu>
  12386. Date:        Mar 13, 1991
  12387. Version:        0.67 Batch Compiler
  12388. System:         Decstation mach (cross compiler to m68)
  12389. Severity:       major
  12390. Problem:        Cross compiler halts with Getscratch
  12391. Code:           The 0.67 compiler sources
  12392. Transcript 1:   I added vertical ellipses to omit part that worked correctly.
  12393.      
  12394. Standard ML of New Jersey, Version 0.67, 21 November 1990 (batch compiler)
  12395. [setreducemore()]
  12396. [reducemore := 0]
  12397. [setrounds()]
  12398. [rounds := 10]
  12399. [setbodysize()]
  12400. [bodysize := 20]
  12401. [mBoot()]
  12402.   .
  12403.   .
  12404.   .
  12405. [Compiling boot/math.sml]
  12406. signature MATH
  12407. structure Math
  12408. boot/math.sml:290.4 Warning: match not exhaustive
  12409.         0 => ...
  12410.         1 => ...
  12411. [closing boot/math.sml]
  12412. [Failed on "~mBoot" with Getscratch]
  12413.  
  12414. Transcript 2:
  12415. Standard ML of New Jersey, Version 0.67, 21 November 1990 (batch compiler)
  12416. [globalhandle := false]
  12417. [markabsyn := false]
  12418. [mBoot()]
  12419.   .
  12420.   .
  12421.   .
  12422. [Compiling env/env.sml]
  12423. structure Env
  12424. [closing env/env.sml]
  12425. [Failed on "!env/env.sml" with Getscratch]
  12426. uncaught exception (Loader): Getscratch
  12427.  
  12428. Comments: The Sun3 Mach batch compiler for m68 works fine.
  12429. Status: fixed in 0.69, Appel suspects.
  12430. ---------------------------------------------------------------------------
  12431. 368. missing exceptions
  12432. Submitter: Larry Paulson (larry.paulson@computer-lab.cambridge.ac.uk)
  12433. Date: 16 Nov 90
  12434. Version: 0.69
  12435. System: 
  12436. Severity: minor
  12437. Problem: 
  12438. You have most, but not all, of those silly arithmetic exceptions.  Larry
  12439. Code: 
  12440. Transcript: 
  12441. - Abs;
  12442. std_in:7.1-7.3 Error: unbound variable Abs
  12443. - Div;
  12444. val it = exn : exn
  12445. - Mod;
  12446. val it = exn : exn
  12447. - Quot;
  12448. std_in:3.1-3.4 Error: unbound variable Quot
  12449. - Prod;
  12450. val it = exn : exn
  12451. - Neg;
  12452. val it = exn : exn
  12453. - Sum;
  12454. val it = exn : exn
  12455. - Diff;
  12456. val it = exn : exn
  12457. - Floor;
  12458. val it = exn : exn
  12459. - Sqrt;
  12460. val it = exn : exn
  12461. - Exp;
  12462. val it = exn : exn
  12463. - Ln;
  12464. val it = exn : exn
  12465. Comments: 
  12466. Fix: edit perv.sml and perv.sig
  12467. Status: fixed in 0.71
  12468. ---------------------------------------------------------------------------
  12469. 369. bug in MLYACC
  12470. Submitter: John Reppy (jhr@cs.cornell.edu)
  12471. Date: May 29 1991
  12472. Version: 0.69
  12473. System: 
  12474. Severity: major
  12475. Problem: 
  12476. I was compiling mlyacc with 0.69 and noticed a couple of problems.
  12477. In addition to the syntax error in yacc.sml (lines 350-351), there is
  12478. also a funny message being generated:
  12479.  
  12480.   [opening yacc.sml]
  12481.   $$ lookTycPath 1: 2 2
  12482.   tyconInContext: [2]
  12483. Code: 
  12484. Transcript: 
  12485. Comments: 
  12486. [jgm] See bugs 307 and 336 -- this may not be MLYACC's fault.
  12487. Fix: see 336.
  12488. Status: fixed in 0.71
  12489. ---------------------------------------------------------------------------
  12490. 370. Wrong definition of div & mod in perv.sml
  12491. Submitter:      Andrzej Filinski <andrzej@cs.cmu.edu>
  12492. Date:        3/16/91
  12493. Version:        0.67
  12494. System:         All (verified on PMAX, Mach/4.3 BSD)
  12495. Severity:       major
  12496. Problem:        Wrong definition of div & mod in perv.sml
  12497. Code:           0 div ~2
  12498. Transcript:     - 0 div ~2;
  12499.         val it = ~1 : int
  12500.         - 0 mod ~2;
  12501.         val it = ~2 : int
  12502. Comments:    Definition (p.79) requires a result of 0 in both cases.
  12503. Fix:        
  12504. In boot/perv.sml, "structure Integer = ...", replace
  12505. <   fun op div(a:int,b:int):int =
  12506. <               if a>=0
  12507. <                   then if b>=0 then InLine.div(a,b)
  12508. <                                else InLine.div(a-1,b)-1
  12509. <                   else if b>=0 then InLine.div(a+1,b)-1
  12510. <                                else InLine.div(a,b)
  12511. with
  12512. >    fun op div(a:int,b:int):int =
  12513. >        if b>=0
  12514. >             then if a>=0 then InLine.div(a,b)
  12515. >                     else InLine.div(a+1,b)-1
  12516. >            else if a>0  then InLine.div(a-1,b)-1
  12517. >                 else InLine.div(a,b)
  12518. Status: fixed in 0.71
  12519. ---------------------------------------------------------------------------
  12520. 371. intmap bug
  12521. Submitter: Chet Murthy (murthy@cs.cornell.edu)
  12522. Date: 13 Jun 91
  12523. Version: 
  12524. System: 
  12525. Severity: 
  12526. Problem: I was using intmap to implement a hash table, and I found what appears
  12527. to be a bug.  
  12528. Code: 
  12529. (* requires intmap.sig and intmap.sml to be loaded
  12530.    To see the bug, run "try 477 trace;" and "try 476 trace;"
  12531.    the variable longtrace is bound to an even longer trace.
  12532.  
  12533.    Each will, for each N in the list, add (N,CTR) to the
  12534.    intmap, and then increment CTR.
  12535.  
  12536.    Then each will dump the intmap with intMapToList, and compare
  12537.    the cardinality of the domain (computed by getting the first
  12538.    projection of each pair in the graph given by intMapToList and
  12539.    and uniquifying it) to the actual length of the list returned
  12540.    by intMapToList.
  12541.  
  12542.    The function repeated will print out all the pairs (N,V) such
  12543.    that N appears more than once in the graph.  Try
  12544.    "repeated 476 trace" and observe that the output is empty,
  12545.    whereas "repeated 477 trace" produces "[(29,476),(29,316)]"
  12546.    meaning that both pairs showed up in the trace.
  12547.    *)
  12548.  
  12549. (* splits a list into the first N elts and the tail *)
  12550. fun chopList(0,l) = (nil,l)
  12551.   | chopList(n,h::t) =
  12552.     let val (m,l') = chopList(n-1,t) in
  12553.         (h::m,l')
  12554.     end
  12555.  
  12556.  
  12557. fun member x nil = false
  12558. |   member x (h::t) = if x = h then true else member x t
  12559.  
  12560. fun uniquize nil = nil
  12561. |   uniquize (h::t) = if member h t then uniquize t else h::(uniquize t)
  12562.  
  12563.   fun collect f l = fold List.@ (map f l) nil
  12564.  
  12565. fun runTo n l =
  12566.     let val (pref,_) = chopList(n,l)
  12567.         val ctr = ref 0
  12568.         val imap = Intmap.new(100,General.Match)
  12569.         fun go nil = ()
  12570.           | go (h::t) = (Intmap.add imap (h,!ctr);inc ctr;go t)
  12571.     in
  12572.         (go pref;Intmap.intMapToList imap)
  12573. end
  12574.  
  12575. fun try n trace = uniquize(map #1 (runTo n trace))
  12576.     = (map #1 (runTo n trace))
  12577.  
  12578. fun repeated n trace =
  12579.     let val graph = runTo n trace
  12580.         fun aux nil = nil
  12581.           | aux (h::t) = 
  12582.             (if member h t then [h] else nil)@(aux t)
  12583.         fun find x nil = nil
  12584.           | find x ((a,b)::t) =
  12585.             (if x = a then [(a,b)] else nil)@(find x t)
  12586.         val repetitions = aux (map #1 graph)
  12587.     in
  12588.         collect (fn x => find x graph) repetitions
  12589.     end
  12590.  
  12591. val trace =
  12592.     [26,98,96,64,32,52,62,91,23,53,41,30,58,67,29,16,37,
  12593.     68,51,62,89,70,5,10,76,50,90,16,51,47,48,74,32,21,
  12594.     68,33,55,58,19,12,19,81,60,31,38,15,45,69,32,19,38,
  12595.     44,0,50,97,15,8,79,55,23,3,81,11,3,23,64,26,74,23,
  12596.     57,93,69,41,66,19,96,20,63,25,90,8,44,98,98,82,40,
  12597.     46,18,81,92,65,35,65,77,98,45,39,87,46,64,2,48,43,
  12598.     2,79,83,25,41,42,98,71,39,44,65,40,77,54,32,12,15,
  12599.     80,76,55,26,43,20,57,77,15,66,11,92,64,4,8,1,22,5,
  12600.     66,39,48,17,72,41,76,28,56,41,6,69,89,31,38,44,51,
  12601.     9,64,85,45,37,82,20,97,93,82,61,18,0,27,6,17,65,20,
  12602.     23,0,23,39,98,66,75,54,23,19,77,96,57,78,22,50,30,
  12603.     13,63,84,88,12,83,84,22,41,68,61,54,60,4,69,84,10,
  12604.     21,50,35,28,89,11,62,12,75,69,80,95,6,98,94,2,84,
  12605.     60,29,51,72,77,6,20,5,95,29,97,21,49,30,89,3,70,53,
  12606.     28,74,37,59,96,22,52,65,6,98,91,22,95,8,7,65,60,61,
  12607.     44,47,62,76,30,63,46,32,94,26,30,7,73,79,29,57,12,
  12608.     15,14,57,9,25,72,89,36,87,57,66,87,59,26,26,26,16,
  12609.     66,68,26,59,59,26,72,22,55,59,73,73,26,64,96,27,73,
  12610.     96,96,26,15,43,29,96,48,48,26,71,8,84,48,68,68,26,
  12611.     31,50,97,68,88,88,26,91,59,40,88,36,36,26,35,44,31,
  12612.     36,16,16,26,39,49,88,16,48,48,26,67,99,21,48,26,27,
  12613.     98,98,98,26,48,46,98,26,26,27,77,77,77,26,0,25,77,
  12614.     26,27,15,92,92,26,61,71,92,26,27,81,81,81,26,48,19,
  12615.     81,26,26,27,15,15,15,26,9,57,15,26,26,27,10,80,80,26,
  12616.     25,48,80,26,26,27,24,24,24,26,23,76,24,26,26,27,99,76,
  12617.     76,26,43,89,76,26,26,27,34,34,34,26,7,74,34,43,6,27,
  12618.     45,26,91,91,26,91,64,91,26,26,27,31,31,31,26,31,54,31,
  12619.     26,26,27,36,13,13,26,86,29]
  12620. Transcript: 
  12621. Comments: Should fix intmap to not allow users to specify initial size.
  12622. Fix: Don't use 100 as the initial size.
  12623. Status: not a bug
  12624. ---------------------------------------------------------------------------
  12625. 372. open in signature causes compiler bug
  12626. Submitter:      Gene Rollins <rollins@cs.cmu.edu>
  12627. Date:           Mar 11 1991
  12628. Version:        0.67
  12629. Severity:       major
  12630. Problem:        open in signature results in compiler reporting a bug
  12631. Code:           
  12632.   signature ARITH = sig
  12633.      structure Term : TERM
  12634.      open Term
  12635.   ...
  12636. Transcript:     
  12637.   - use "src-use/arith.sig.sml";
  12638.   [opening src-use/arith.sig.sml]
  12639.   Error: Compiler bug: EnvAccess.openStructureVar -- bad access value
  12640.   [closing src-use/arith.sig.sml]
  12641. Status: fixed (as of 0.69)
  12642. ---------------------------------------------------------------------------
  12643. 373. bug in printing fully qualified structure names
  12644. Submitter: Andrew Tolmach (apt@princton.edu)
  12645. Date: 16 Apr 91
  12646. Version: 0.69
  12647. System: 
  12648. Severity: minor
  12649. Problem: prints qualified names in the wrong order on error.  Looks
  12650. like someone got the list backwards.
  12651. Code: 
  12652. Transcript: 
  12653. Standard ML of New Jersey, Version 0.69, 3 April 1991
  12654. val it = () : unit
  12655. - structure Fred = struct structure Bill = struct fun f x = x + 1 end end;
  12656. structure Fred :
  12657.   sig
  12658.     structure Bill : sig...end
  12659.   end
  12660. - open Fred.Bill;
  12661. open Fred.Bill
  12662. - f true;
  12663. std_in:4.1-4.6 Error: operator and operand don't agree (tycon mismatch)
  12664.   operator domain: int
  12665.   operand:         bool
  12666.   in expression:
  12667.     Bill.Fred.f true
  12668. Comments: Appel says:  these qualified names shouldn't be there anyway!
  12669. The abstract syntax should in this case match the concrete syntax,
  12670. so the message should say, "f true" not "Fred.Bill.f true".
  12671. Fix: remove "qid@" from varApplied and strApplied in envaccess.sml
  12672. Status: fixed in 0.71
  12673. ---------------------------------------------------------------------------
  12674. 374. mod overflows on some negative numbers
  12675. Submitter: Eric Cooper (ecc@cs.cmu.edu)
  12676. Date: 01 May 91
  12677. Version: 0.66-0.69
  12678. System: Pmax, Vax, Sun4
  12679. Severity: major
  12680. Problem: 
  12681. Code: 
  12682. Transcript: 
  12683. - val minint = ~1073741824;
  12684. val minint = ~1073741824 : int
  12685. - minint mod 10;
  12686.  
  12687. uncaught exception Overflow
  12688. Comments: 
  12689. The SML definition of div and mod is different than that typically provided
  12690. by hardware, thus mod and div actually defined as
  12691.  
  12692.     fun op div(a:int,b:int):int =
  12693.                 if a>=0
  12694.                     then if b>=0 then InLine.div(a,b)
  12695.                                  else InLine.div(a-1,b)-1
  12696.                     else if b>=0 then InLine.div(a+1,b)-1
  12697.                                  else InLine.div(a,b)
  12698.     fun op mod(a:int,b:int):int = a-(a div b)*b
  12699.  
  12700. (see boot/perv.sml).  The "*" in mod is causing the overflow.  You could
  12701. use quot and rem, but they may not give you the answer you want:
  12702.  
  12703.     - ~1073741824 rem 10;
  12704.     val it = ~4 : int
  12705.  
  12706. - John
  12707. Fix: First, see the fix for bug 370.  Second, use a separate case 
  12708. analysis for "mod", don't just call "div".
  12709. Status: fixed in 0.71
  12710. ---------------------------------------------------------------------------
  12711. 375. overflow bugs
  12712. Submitter: John Reppy (jhr@cs.cornell.edu)
  12713. Date: 6 Dec 1990
  12714. Version: 0.67
  12715. System: 
  12716. Severity: major?
  12717. Problem: 
  12718. Dave Berry's library code trips over the following problem with
  12719. large positive integers:
  12720. Code: 
  12721. Transcript: 
  12722.   Standard ML of New Jersey, Version 0.67, 21 November 1990
  12723.   val it = () : unit
  12724.   - ~1073741822;
  12725.   val it = ~1073741822 : int
  12726.   - it+1;
  12727.   val it = ~1073741821 : int
  12728.   - ~it;
  12729.   val it = 1073741821 : int
  12730.   - 1073741821;
  12731.  
  12732.   uncaught exception Overflow
  12733. Comments: 
  12734. dbm@research.att.com writes:
  12735.  > (2) I have had a runbind bug report for 0.69, but it may not be the
  12736.  > same bug you have seen.  I would appreciate it very much if you could
  12737.  > send me formal bug reports on the Runbind and Overflow problems.  We
  12738.  > can certainly cope with redundant bug reports!
  12739.  
  12740. The easiest way to reproduce the Runbind exception is to try to load
  12741. the portable version of the SML library into SML 0.69. I've also had
  12742. it occur when I was doing something with returning options, but that
  12743. code doesn't exist anymore (I changed the structure of the code and
  12744. the problem went away).
  12745.  
  12746. As far as the overflow is concerned:
  12747.  
  12748. eXene -- version 0.2 (alpha) -- April 1, 1991
  12749. Concurrent ML, version 0.9.2, January 15, 1991
  12750. val it = () : unit
  12751. - 1073741823;
  12752.  
  12753. uncaught exception Overflow
  12754. - 1024;
  12755.  
  12756. uncaught exception Overflow           <------ this shouldn't happen
  12757. -
  12758.  
  12759. Standard ML of New Jersey, Version 0.68, March 7, 1991
  12760. val it = () : unit
  12761. - 1073741823;
  12762.  
  12763. uncaught exception Overflow
  12764. - 1024;
  12765.  
  12766. uncaught exception Overflow           <------ this shouldn't happen
  12767. -
  12768.  
  12769. Fix: 
  12770. Status: fixed as of 0.69? ([jgm] works on SGI)
  12771. ---------------------------------------------------------------------------
  12772. 376. empty signatures and functors, parsing
  12773. Submitter: Nick Rothwell (nick@lfcs.ed.ac.uk)
  12774. Date: 21 Nov 1990
  12775. Version: 0.66?
  12776. Severity: minor
  12777. Problem: 
  12778. SML/NJ accepts the following (both of which are not legal SML):
  12779.  
  12780.    signature S = sig end functor F() = struct end;
  12781.  
  12782.    val x = "A" ^ if true then "B" else "C";
  12783. Comment: [dbm]
  12784.   The first problem is an intensional divergence, the second is
  12785.   fixed as of 0.69.
  12786. Status: fixed in 0.69
  12787. ---------------------------------------------------------------------------
  12788. 377. prop.sml has bug
  12789. Submitter: 
  12790. Date: Dec 25 1990
  12791. Version: 0.66
  12792. System: 
  12793. Severity: minor
  12794. Problem: 
  12795. ../66/doc/examples/prop.sml doesn't correctly change to conjunctive
  12796. normal form.  (* exercise *)
  12797. Code: 
  12798. Transcript: 
  12799. Comments: 
  12800. Fix:  Put comment at top of prop.sml saying that it has bugs.
  12801. Status: fixed in 0.71 (comment put in!)
  12802. ---------------------------------------------------------------------------
  12803. 378. Error: Compiler bug: Functor.applyFunctor.redoTycs 1
  12804. Submitter: Elsa Gunter (elsa@research.att.com)
  12805. Date: Mar 8 1991
  12806. Version: 0.66 & 0.67
  12807. System: mips mips and sun3 with SunOS 4.0
  12808. Severity: major
  12809. Problem: Error: Compiler bug: Functor.applyFunctor.redoTycs 1
  12810. Code: 
  12811. (* File bug1.sml *)
  12812.  
  12813. signature AA =
  12814.     sig
  12815.     datatype s  =  a of t * s
  12816.     and t = b of s
  12817. end  (* signature AA *)
  12818.  
  12819. signature BB =
  12820.     sig
  12821.     structure A : AA
  12822. end  (* signature BB *)
  12823.  
  12824.  
  12825. signature CC =
  12826.     sig
  12827.     structure B : BB
  12828.     type u
  12829. end  (* signature CC *)
  12830.  
  12831. functor F (structure B : BB) : CC =
  12832.     struct
  12833.     structure B = B
  12834.     structure A = B.A
  12835.     open A
  12836.     type u = t * s
  12837.     end (* functor F *)
  12838.  
  12839. structure C : CC = F (structure B = B);
  12840. Transcript: 
  12841. - use "bug1.sml";
  12842. [opening bug1.sml]
  12843. bug1.sml:27.37 Error: unbound structure name: B
  12844. bug1.sml:27.20 Error: unmatched structure spec: A
  12845. Error: Compiler bug: Functor.applyFunctor.redoTycs 1
  12846. [closing bug1.sml]
  12847. -
  12848. Comments: 
  12849. Fix: Cascade
  12850. Status: fixed in 0.71
  12851. ---------------------------------------------------------------------------
  12852. 379. redundant patterns
  12853. Submitter: John Reppy (jhr@cs.cornell.edu)
  12854. Date: Jan 25 1991
  12855. Problem: 
  12856. I would like to suggest that the compiler reject redundant patterns as
  12857. errors (possibly with a flag to generate only warnings to preserve
  12858. compatibility with "The Definition").  The reason for this change is
  12859. that it will force the user to deal with potential errors (warning
  12860. messages usually get buried in the output).  Often, a redundant pattern
  12861. is the result of a mis-spelled constructor name, and so is actually an
  12862. error (there is an example of this in the 0.67 version of the debugger).
  12863. Transcript: 
  12864. I noticed the following redundant pattern warnings while compiling
  12865. 0.67.  The debugger ones are definitely an error.
  12866.   - John
  12867.  
  12868. translate/translate.sml:227.30 Warning: redundant patterns in match
  12869.         VALtrans (PATH p) => ...
  12870.         VALtrans (INLINE eql) => ...
  12871.         VALtrans (INLINE neq) => ...
  12872.         VALtrans (INLINE i) => ...
  12873.         THINtrans (PATH p,v,locs) => ...
  12874.         CONtrans (d as DATACON {const=true,...}) => ...
  12875.         CONtrans (d as DATACON {const=false,...}) => ...
  12876.         VALtrans a => ...
  12877.         THINtrans (a,_,_) => ...
  12878.   -->   _ => ...
  12879.  
  12880.  
  12881. build/process.sml:334.32 Warning: redundant patterns in match
  12882.         ({access=SLOT s1,name=name},{access=SLOT s2,name=_}) => ...
  12883.         ({access=SLOT _,...},_) => ...
  12884.         ({access=PATH (:: (<pat>,<pat>)),...},{access=PATH (:: (<pat>,<pat>)),...}) => ...
  12885.         ({access=PATH _,...},_) => ...
  12886.         ({access=INLINE i1,...},{access=INLINE i2,...}) => ...
  12887.         ({access=INLINE _,...},_) => ...
  12888.   -->   _ => ...
  12889.  
  12890.  
  12891. debug/historystore.sml:371.1 Warning: redundant patterns in match
  12892.         (a,weak_desc) => ...
  12893.   -->   (_,tag) => ...
  12894. debug/historystore.sml:371.1 Warning: redundant patterns in match
  12895.         (a,weak_desc) => ...
  12896.   -->   (_,tag) => ...
  12897. debug/historystore.sml:371.1 Warning: redundant patterns in match
  12898.         (a,weak_desc) => ...
  12899.   -->   (_,tag) => ...
  12900.  
  12901. Status: not a bug (a suggestion)
  12902. ---------------------------------------------------------------------------
  12903. 380. regbind compiler bug
  12904. Submitter:    Eric Cooper, ecc@cs.cmu.edu
  12905. Date:    Dec 5, 1990
  12906. Version:    0.66
  12907. System:    VAX and SPARC running Mach 2.5
  12908. Severity:    major
  12909. Problem:    compiler raises Regbind; top-level dumps core
  12910. Code:
  12911.  
  12912. (*
  12913. This example causes the compiler to raise Regbind on
  12914.     SML/NJ 0.66 on Sparc
  12915.     SML/NJ 0.65 on VAX
  12916. After the exception message is printed, typing () to
  12917. the top level causes an illegal instruction trap.
  12918.  
  12919. It doesn't fail if:
  12920.     functor is replaced by a structure
  12921.     (name ^ "\n") is replaced by name
  12922.     (n mod period = 0) is replaced by (n + period = 0)
  12923.     the tail recursive call to proc () is removed
  12924. *)
  12925.  
  12926. functor Broken (S : sig
  12927.             val perform : (unit -> 'a) -> 'a
  12928.             end) =
  12929.     struct
  12930.     val period = 0
  12931.     val name = "foo"
  12932.     val n = 0
  12933.         
  12934.     fun proc () =
  12935.         (if n mod period = 0 then
  12936.          S.perform (fn () => print (name ^ "\n"))
  12937.          else
  12938.          ();
  12939.          proc ())
  12940.     end
  12941.  
  12942. (* Transcript:
  12943.  
  12944. Standard ML of New Jersey, Version 0.66, 15 September 1990
  12945. val it = () : unit
  12946. - [opening bug.sml]
  12947. [closing bug.sml]
  12948.  
  12949. uncaught exception Regbind
  12950. - ();
  12951. SIGILL code 0x2
  12952.  
  12953. Process Inferior sml exited abnormally with code 3
  12954.  
  12955. *)
  12956. Status: fixed? ([jgm] works on SGI)
  12957. ---------------------------------------------------------------------------
  12958. 381. saving registers for signal handler continuation
  12959. Submitter: Andrew Tolmach (apt@princeton.edu)
  12960. Date: 14 may 1991
  12961. Version: 0.69
  12962. System: 
  12963. Severity: major
  12964. Problem: 
  12965. Andrew Tolmach discovered an interesting bug, which he and I traced
  12966. further.  Summary:
  12967.  
  12968. At a heap-limit check (typically an add-to-limit-causing-overflow),
  12969. there are two kinds of general-purpose registers:
  12970.  
  12971. 1.  Live Pointers or Tagged Integers.  These get a 1 in the register mask.
  12972. 2.  Dead Pointers, Live Untagged Integers, or anything else. 
  12973.      These get a 0.
  12974.  
  12975. Thus, a 0 in the mask does NOT indicate "dead."  Registers with a 1
  12976. in the mask should be forwarded (if pointers) by the G.C., and
  12977. registers with a 0 should be preserved unchanged.
  12978.  
  12979. Unfortunately, the function "make_ml_sigh_arg" was not preserving the 
  12980. 0-in-the-mask registers, so that the string-creation function create_s
  12981. was losing a register if a signal occurred.
  12982. Code: 
  12983. Transcript: 
  12984. Comments: 
  12985. From: David.Tarditi@LAMBDA.ERGO.CS.CMU.EDU
  12986. Status: R
  12987.  
  12988. You write:
  12989.  
  12990. > Thus, a 0 in the mask does NOT indicate "dead."  Registers with a 1
  12991. > in the mask should be forwarded (if pointers) by the G.C., and
  12992. > registers with a 0 should be preserved unchanged.
  12993. >
  12994. > Unfortunately, the function "make_ml_sigh_arg" was not preserving the 
  12995. > 0-in-the-mask registers, so that the string-creation function create_s
  12996. > was losing a register if a signal occurred.
  12997.  
  12998. Is having ml_sigh_arg preserve all registers the right thing to do ?
  12999. Maybe we should enforce the invariant that a 0 in the mask
  13000. indicates "dead" ?   The argument for doing this is that it
  13001. makes signal handling cheaper in both time and space.  Right now,
  13002. make_ml_sigh_arg only has to save the number of used registers.
  13003. It scans each bit in the mask to determine which registers to
  13004. save until the remainder of the mask is 0, so it takes less time also,
  13005. if live registers tend to be the lower numbered registers (as they do
  13006. with the current register allocator).
  13007.  
  13008. The argument for not doing this is that is allows us to do
  13009. "representation analysis", i.e. place untagged integers in
  13010. registers across procedure boundaries.  I don't know what
  13011. the performance gain from this will be.
  13012.  
  13013.    Dave
  13014.  
  13015. From: Andrew Appel <appel@Princeton.EDU>
  13016. John Reppy has found that signal-handling overhead isn't too bad
  13017. (3% for 20-millisecond timer interrupts on a SPARC), and saving
  13018. a few extra register shouldn't make a huge difference.
  13019. I would certainly hate to rule out passing untagged integers across
  13020. procedure boundaries.
  13021. Fix: 
  13022. Status: not yet a bug
  13023. ---------------------------------------------------------------------------
  13024. 382. missing \n on infix echo
  13025. Submitter: Eric Cooper (ecc@cs.cmu.edu)
  13026. Date: Jun 11 1991
  13027. Version: 0.69
  13028. System: 
  13029. Severity: minor
  13030. Problem: 
  13031. First, a trivial one: the top-level omits the \n when echoing global infix
  13032. declarations:
  13033. Code: 
  13034. Transcript: 
  13035.     Standard ML of New Jersey, Version 0.69, 3 April 1991
  13036.     val it = () : unit
  13037.     - infix operator;
  13038.     infix operator-
  13039. (In 0.65, infix declarations weren't being printed at all.)
  13040.  
  13041. Comments: 
  13042. Fix: insert newline() at end of printFixity function in print/printdec.sml
  13043. Status: fixed in 0.71
  13044. ---------------------------------------------------------------------------
  13045. 383. open in nested structures fails with "Runbind"
  13046. Submitter: Eric Cooper (ecc@cs.cmu.edu)
  13047. Date: Jun 11 1991
  13048. Version: 0.69
  13049. System: 
  13050. Severity: major
  13051. Problem: 
  13052. The "print x" below fails with exception "Runbind".
  13053. Code: 
  13054.     structure S =
  13055.         struct
  13056.         val x = 0
  13057.         end;
  13058.  
  13059.     structure SS =
  13060.         struct
  13061.         structure S = S
  13062.         end
  13063.  
  13064.     open S;
  13065.  
  13066.     open SS;
  13067.  
  13068.     print x;    (* fails with exception Runbind *)
  13069. Transcript: 
  13070. Comments: 
  13071. This worked OK in 0.65.  Among other things, Paulson's Isabelle examples 
  13072. now fail to compile, which is how I tripped over this.
  13073. Fix: Appel partially diagnosed this, sent mail to MacQueen
  13074. Status: fixed in 0.73
  13075. ---------------------------------------------------------------------------
  13076. 384. signal handler never re-installed
  13077. Submitter:    Manuel Fahndrich (mf39@andrew.cmu.edu)
  13078. Date:         6/4/91
  13079. Version:      0.66 0.67
  13080. System:       DECstation 3100 (Mach and BSD UNIX 4.3)
  13081. Problem:      The signal handlers only get called the first time they are
  13082.               installed. Once setHandler(signal, NONE) is executed and then
  13083.               setHandler(signal, SOME handler), the signal is ignored.
  13084.               Tested on signals (SIGIO, SIGINT, SIGALRM)
  13085.  
  13086. Transcript:   fun ioh (_, k) = (print "SIGIO\n"; k);
  13087.               System.Signals.setHandler (System.Signals.SIGIO, SOME ioh);
  13088.               <ok, this works>
  13089.               System.Signals.setHandler (System.Signals.SIGIO, NONE);
  13090.               <ok, ignored>
  13091.               System.Signals.setHandler (System.Signals.SIGIO, SOME ioh);
  13092.               <wrong, still ignored!!!>
  13093.  
  13094. Comment:      The inqHandler returns the correct handler function at the end.
  13095. [jgm] The following code really exercises the bug:
  13096.  
  13097.   open System.Signals;
  13098.   setHandler(SIGINT, NONE);
  13099.   inqHandler(SIGINT);
  13100.   (* core dumps *)
  13101.  
  13102. Code for setHandler and inqHandler is simple enough to figure that the
  13103. bug is probably in the code generator -- it's broken on Mach and Irix,
  13104. so the OS is not to blame.  Also, ripping the signal handling code
  13105. in perv.sml out and compiling it on top of the pervasives makes the
  13106. bug go away.
  13107.  
  13108. (1) Suppose we do :
  13109.  
  13110. open System.Signals;
  13111. open System.Timer;
  13112. val setitimer = System.Unsafe.CInterface.setitimer;
  13113. fun setTimer msec =  (setitimer(0,TIME{sec=0,usec=1000*msec}, 
  13114.                    TIME{sec=0,usec=1000*msec}));
  13115. setHandler(SIGALRM,SOME(fn (_,k) => (print "hi!\n";k)));
  13116. setTimer 500;
  13117.  
  13118. This will print hi! twice a second (on cs or elan) or (roughly speaking) 
  13119. when return is hit (on haven), more or less as expected.
  13120.  
  13121. (2) Now suppose we do :
  13122.  
  13123. setHandler(SIGALRM,NONE); 
  13124. setHandler(SIGALRM,SOME(fn (_,k) => (print "lo!\n";k)));
  13125.  
  13126. On all machines, this has no visible effect; that is, lo! is not printed.
  13127.  
  13128. (3) But if we then do:
  13129.  
  13130. System.Unsafe.CInterface.c_function "enablesig" (3,true);
  13131.  
  13132. we do start seeing lo! just as we saw hi! before.
  13133.  
  13134.  
  13135. Finally, and most excitingly, if we do (1) followed by:
  13136.  
  13137. setHandler(SIGALRM,NONE); 
  13138. inqHandler SIGALRM;
  13139.  
  13140. we get the following results:
  13141.  
  13142. on haven and k2 (both versions):
  13143.  
  13144. Bus Error
  13145.  
  13146. on elan:
  13147.  
  13148. - Fixed up unaligned data access for pid 16679 (sml) at pc 0x417ed0
  13149. val it = SOME fn : (int * (unit) cont -> (unit) cont) option
  13150.  
  13151.  
  13152. on cs:
  13153.  
  13154. val it = SOME fn : (int * (unit) cont -> (unit) cont) option
  13155. [jgm]
  13156. See bug 397 for the probable cause...
  13157. Status: should be fixed in 0.70
  13158. ---------------------------------------------------------------------------
  13159. 385. SIGHUP, SIGQUIT, SIGTERM ignored sometimes
  13160. Submitter: Mark Foster (mark@central.cis.upenn.edu)
  13161. Date: Nov 15 1990
  13162. Version: 0.66
  13163. System: 
  13164. Severity: minor
  13165. Problem: 
  13166. It appears that some signals get ignored when they shouldn't.
  13167. In particular, SIGHUP SIGQUIT and SIGTERM don't get properly delivered
  13168. when the parent process of sml exits in certain ways.  As a result,
  13169. the sml process remains, sometimes dormant, and sometimes in a spin
  13170. loop (continuous select() calls, trying to output a message, but it
  13171. can't because it's psuedo tty is "gone").
  13172.  
  13173. The easiest way we've found to demonstrate the problem is via telnet
  13174.  
  13175.     % telnet me
  13176.     Trying 127.0.0.1 ...
  13177.     Connected to LOCALHOST.UPENN.EDU.
  13178.     Escape character is '^]'.
  13179.  
  13180.     (login stuff deleted)
  13181.     % sml
  13182.     Standard ML of New Jersey, Version 0.66, 15 September 1990
  13183.     val it = () : unit
  13184.     -
  13185.  
  13186. now, escape back to telnet, then close the connection
  13187.     ^]
  13188.     telnet> c
  13189.  
  13190. the sml process does not exit.
  13191.  
  13192. WORKAROUNDS:
  13193.  
  13194. We have two possible workarounds to this problem.  Fundamentally, the
  13195. output that's trying to happen probably needs to be fixed.  Either
  13196. to detect when it cannot successfully output or to just give up at some
  13197. point.  The following two approaches don't do fix the problem, they just 
  13198. bandaid around it.  Both methods "cure" the problems we've been 
  13199. experiencing.
  13200.  
  13201. Method 1:
  13202. Change runtime/signal.c to disallow redefining of the signals used to
  13203. shutdown a child process
  13204.  
  13205. % diff signal.c.orig signal.c
  13206. 210c210,214
  13207. <             case ML_SIG_ENABLED: SETSIG (sig, sig_handler, SIGMASK); break;
  13208. ---
  13209. >             case ML_SIG_ENABLED:  if ((sig != SIGQUIT) &&
  13210. >                                       (sig != SIGHUP) && (sig != SIGTERM)) {
  13211. >                                     SETSIG (sig, sig_handler, SIGMASK);
  13212. >                                   }
  13213. >               break;
  13214. 234c238,241
  13215. <           SETSIG (sig, sig_handler, SIGMASK);
  13216. ---
  13217. >         if ((sig != SIGQUIT) &&
  13218. >             (sig != SIGHUP) && (sig != SIGTERM)) {
  13219. >             SETSIG (sig, sig_handler, SIGMASK);
  13220. >           }
  13221.  
  13222.  
  13223. Method 2:
  13224. Change boot/perv.sml to not attempt to output a message on quit
  13225.  
  13226. % diff perv.sml.orig perv.sml
  13227. 1871,1873c1871
  13228. <     fun quit s _ = (
  13229. <         output(std_err, s); output(std_err, " (no coredump)\n");
  13230. <         System.Unsafe.CleanUp.shutdown())
  13231. ---
  13232. >     fun quit s _ = (System.Unsafe.CleanUp.shutdown())
  13233.  
  13234. Date: Sun, 18 Nov 90 09:58:41 -0500
  13235. From: jhr@cs.cornell.edu (John Reppy)
  13236. Subject: Re:  signal info from Mark Foster at Penn.
  13237. Status: R
  13238.  
  13239. I've seen this effect, but I never thought about it enough
  13240. to realize what was going on.  His first solution is an
  13241. awkward way to say the ML can't handle SIGHUP, SIGQUIT
  13242. and SIGTERM; I like to avoid that.  His second solution is
  13243. better; but there probably should be a warning somewhere
  13244. abut the problems with SIGHUP.
  13245.   - John
  13246.  
  13247. From: jhr@cs.cornell.edu (John Reppy)
  13248. Subject: Re:  signal info from Mark Foster at Penn.
  13249. Cc: mark@central.cis.upenn.edu
  13250. Status: R
  13251.  
  13252. I think that this problem is a bug in the way select works.  If you do
  13253. a select on a closed file, it fails with EBADF; I think it should do the
  13254. same if the ptty has gone away.  But we live in an imperfect world, so
  13255. I recommend the following fix:
  13256.  
  13257. Replace the function quit (at the end of perv.sml) with the following
  13258. code:
  13259.  
  13260.     fun quit s _ = let val msg = (s ^ " (no coredump)\n\000")
  13261.       in
  13262.       (* use write, since IO.output will block if we've lost the ptty *)
  13263.         System.Unsafe.SysIO.write(2, System.Unsafe.cast msg, size msg)
  13264.           handle _ => ();
  13265.         System.Unsafe.CleanUp.shutdown()
  13266.       end
  13267.  
  13268. Status: fixed (0.69)
  13269. ---------------------------------------------------------------------------
  13270. 386. printing bug with abstype
  13271. Submitter: *jhr$
  13272. Date: Nov 8 1990
  13273. Version: 0.69
  13274. System: 
  13275. Severity: minor
  13276. Problem: 
  13277. Notice the misplaced white space:
  13278.  
  13279.   - abstype 'a foo = Foo of 'a with end;
  13280.   type'a  foo
  13281. Code: 
  13282. Transcript: 
  13283. Comments: 
  13284. Fix: search for "type" in print/printdec.sml  (also "eqtype")
  13285. Status: fixed in 0.71
  13286. ---------------------------------------------------------------------------
  13287. 387. arrays on Sparc
  13288. Submitter: ark
  13289. Date: Feb 12 1991
  13290. Version: 0.66
  13291. System: Sparcstation
  13292. Severity: major
  13293. Problem: dumps core when allocating large array
  13294. Code: 
  13295. array(10000000,0)
  13296. Transcript:
  13297. Comments:
  13298. Fix:
  13299. Status: fixed in 0.69
  13300. ---------------------------------------------------------------------------
  13301. 388. * as label of record
  13302. Submitter: Nick Rothwell (nick@lfcs.ed.ac.uk)
  13303. Date: 8 Nov 90
  13304. Version: 
  13305. System: 
  13306. Severity: minor
  13307. Problem:
  13308. SML/NJ doesn't allow
  13309.  
  13310.    { * = "Hello" }
  13311.  
  13312. as an expression. It should; after all, "*" is (chortle) just an ordinary
  13313. identifier.
  13314. Code:
  13315. Transcript:
  13316. Comments:
  13317. Fix:
  13318. Status: fixed (as of 0.69)
  13319. ---------------------------------------------------------------------------
  13320. 389. stats 
  13321. Submitter: Andrew Appel (appel@princeton.edu)
  13322. Date: Apr 3 1991
  13323. Version: 0.66-0.69
  13324. System:
  13325. Severity: minor
  13326. Problem:
  13327. Bug report: versions 0.66-0.69
  13328. System.Stats.execution  (as reported in "summary()") starts out negative.
  13329. Caused by the following sequence in "interact.sml":
  13330. t := current cpu usage; exportML; t' := current cpu usage;
  13331. System.Stats.execution := t'-t
  13332. But of course, t' is less than t IN THE NEW PROCESS.
  13333. Code:
  13334. Transcript:
  13335. Comments:
  13336. Fix: Appel has a fixt for this that will go into 0.70
  13337. Status: fixed in 0.70
  13338. ---------------------------------------------------------------------------
  13339. 390.
  13340. Submitter:      bpwing@phoenix.princeton.edu
  13341. Date:        March 19, 1991
  13342. Version:        0.65-0.69
  13343. System:         SUN 4, v4.1?
  13344. Severity:       minor
  13345. Problem:        when reporting error positions, tabs are treated as single
  13346.         characters instead of being expanded
  13347. Comments: [jgm -- this seems correct to me...]
  13348. Status: not a bug
  13349. ---------------------------------------------------------------------------
  13350. 391. truncate
  13351. Submitter: David Taridti (dtarditi@cs.cmu.edu)
  13352. Date: Apr 10 1991
  13353. Version: 0.69
  13354. System:
  13355. Severity: major
  13356. Problem:
  13357. The function truncate does not work properly for large real
  13358. numbers.  For example, truncate of 4 billion yields a negative integer
  13359. when it should raise the exception Overflow:
  13360. Code:
  13361. Transcript:
  13362. Standard ML of New Jersey, Version 0.69, 3 April 1991
  13363. val it = () : unit
  13364. - truncate(4000000000.0);
  13365. val it = ~294967296 : int
  13366. Comments:
  13367. Status: fixed in 0.71
  13368. ---------------------------------------------------------------------------
  13369. 392. two type constraints
  13370. Submitter: Larry Paulson (lcp@computer-lab.cambridge.ac.uk)
  13371. Date: 14 Nov 90
  13372. Version: 0.66
  13373. System:
  13374. Severity: minor
  13375. Problem:
  13376. As I understand the Definition, Poly/ML is correct.  Two type constraints might
  13377. be handy if the program involves a lot of type synonyms.  Comments?
  13378. Code:
  13379. Transcript:
  13380. Standard ML of New Jersey, Version 0.66, 15 September 1990
  13381. - 0 : int : int;
  13382. std_in:2.9 Error: syntax error found at COLON
  13383.  
  13384. Poly/ML v1.89 - Definition of SML Version 4
  13385. > 0 : int : int;
  13386. val it = 0 : int
  13387. Comments:
  13388. Fix:
  13389. Status: fixed (as of 0.69)
  13390. ---------------------------------------------------------------------------
  13391. 393. type abbreviations not transparent
  13392. Submitter: Chris Okasaki (cokasaki@cs.cmu.edu)
  13393. Date: 11/16/90
  13394. Version: 0.65
  13395. Severity: minor
  13396. Problem: type abbreviations not transparent
  13397.   In particular, when the type abbreviation takes an argument which
  13398.   does not appear on the right hand side of the abbreviation, any type
  13399.   which appears in that position should be completely irrelevant.  But
  13400.   in the current implementation this is not true.
  13401. Code:
  13402.     type ('a,'b) bogus = 'a;
  13403.     val x = 0 : (int,int) bogus; (* really int *)
  13404.     val y = 1 : (int,int list) bogus; (* really int *)
  13405.     fun f (x:'a,y:'a) = ();  (* force the types to unify *)
  13406.     f (x,y);  (* unify (int,int) bogus and (int,int list) bogus *)
  13407.                   (* should be equivalent to unifying int with int  *)
  13408.                   (* but it's not                                   *)
  13409. Transcript:
  13410.     Standard ML of New Jersey, Version 0.65, 10 September 1990
  13411.     val it = () : unit
  13412.     - type ('a,'b) bogus = 'a;
  13413.     type ('a,'b)  bogus = 'a
  13414.     - val x = 0 : (int,int) bogus;
  13415.     val x = 0 : (int,int) bogus
  13416.     - val y = 1 : (int,int list) bogus;
  13417.     val y = 1 : (int,int list) bogus
  13418.     - fun f (x:'a,y:'a) = ();
  13419.     val f = fn : 'a * 'a -> unit
  13420.     - f (x,y);
  13421.     std_in:3.1-3.7 Error: operator and operand don't agree (tycon mismatch)
  13422.       operator domain: (int,int) bogus * (int,int) bogus
  13423.       operand:         (int,int) bogus * (int,int list) bogus
  13424.       in expression:
  13425.         f (x,y)
  13426.     -
  13427. Comments:
  13428.   Interestingly enough, this doesn't seem to happen when you have a unary
  13429.   type abbreviation like
  13430.     type 'a bogus = int
  13431.  
  13432.   The problem seems to boil down to WHEN you project through abbreviations
  13433.   (i.e. when you do the "macro" expansion).  There seems to be at least two
  13434.   possibilities, project through before a unification containing this type,
  13435.   or attempt to unify with this type and project through only if this fails.
  13436.   As long as every argument to the type abbreviation also appears in the
  13437.   expanded form, the two are equivalent.  When an argument DOESN'T appear in
  13438.   expanded form, the second approach (which is the approach currently
  13439.   being used) causes problems.  As is evident in the above example, it
  13440.   causes the typechecker to unify things which should not be unified.
  13441.  
  13442.   The following code from unify.sml (in unifyTy) is where the problem is:
  13443.        | (CONty(tycon1, args1), CONty(tycon2, args2)) =>
  13444.            if eqTycon(tycon1, tycon2)
  13445. ----->           then unifyArgs(args1, args2)
  13446.            else (unifyTy(reduceType ty1, ty2)
  13447.              handle ReduceType =>
  13448.                unifyTy(ty1, reduceType ty2)
  13449.                handle ReduceType => raise Unify("tycon mismatch"))
  13450.  
  13451.   The point marked is where the damage is done.  If both types have the same
  13452.   abbreviation constructor, unification will blithely go ahead and try to
  13453.   unify ALL of the arguments, even though some of them might be irrelevant
  13454.   because they are unused.
  13455.  
  13456. Fix:
  13457.   Three possibilities:
  13458.     1. Decide that this is a "feature", that you really don't want
  13459.        (int,int) bogus to unify with (int,int list) bogus.  However,
  13460.        I would argue that if this is what you want, you should be using
  13461.        the datatype facility, not the type facility.
  13462.     2. Forbid type abbreviations which do not use all their arguments.
  13463.        This is somewhat unsatisfying since, although human programmers
  13464.        will probably not produce abbreviations like this, it is easy
  13465.        to imagine automatic programming utilities (like Lex or Yacc) that
  13466.        MIGHT produce such code.
  13467.     3. Perform abbreviation expansion BEFORE unifying an abbreviated
  13468.        type with anything except a type variable (you would want to
  13469.        unify the type variable with the abbreviated type so that
  13470.        it can be printed correctly).  The best way to do this is
  13471.        probably to define a new constructor for the type "ty" called
  13472.        something like ABBREVty of tycon * tylist * ty where the
  13473.          tycon is the abbreviation constructor
  13474.          tylist are the constructor's arguments
  13475.          and ty is the "macro expanded" type
  13476.  
  13477.        Then, in unifyTy, you could have (right after the two VARty clauses)
  13478.       | (ABBREVty(_,_,ty),_) => unifyTy(ty,ty2)
  13479.       | (_,ABBREVty(_,_,ty)) => unifyTy(ty1,ty)
  13480.        to project through the abbreviation appropriately.
  13481.  
  13482.        The catch to this is that you can then produce circular types
  13483.        so you would have to perform an occur check during type printing.
  13484.        For instance, consider the following:
  13485.         type ('a,'b) bogus;
  13486.         fun f (x:'b,y:('a,'b) bogus) = ();
  13487.                 fun g x = f (x,x);
  13488.        What is the type of g?  Really, it's 'a->unit but internally
  13489.        it's something like (pardon the abuse of notation):
  13490.         ABBREVty(bogus,['a,*],'a) --> unit
  13491.        where the * marks a circular reference back to the ABBREVty object.
  13492.        Obviously, a naive attempt to print this type will infinite loop--
  13493.        hence the requirement for an occur check during type printing.
  13494. Status: fixed in 0.74 (dbm)
  13495. ---------------------------------------------------------------------------
  13496. 394. strange message in 0.66 typechecker
  13497. Submitter: John Reppy (jhr@cs.cornell.edu)
  13498. Date: 6 Nov 1990
  13499. Version: 0.66
  13500. Severity: minor
  13501. Code:
  13502. Transcript:
  13503.   Standard ML of New Jersey, Version 0.66, 15 September 1990
  13504.   val it = () : unit
  13505.   - signature SAMPLER =
  13506.   =   sig
  13507.   =     type time sharing type time = System.Timer.time
  13508.   =     val init : unit -> unit
  13509.   =     val sample : (time * int * int) -> unit
  13510.   =   end;
  13511.   signature SAMPLER =
  13512.     sig
  13513.       isEqTycon 1 UNDEF
  13514.   type time
  13515.       val init : unit -> unit
  13516.       val sample : time * int * int -> unit
  13517.     end
  13518.   - 
  13519. Status: fixed (as of 0.69)
  13520. ---------------------------------------------------------------------------
  13521. 395. weakness constraint problem
  13522. Submitter: John Reppy (jhr@cs.cornell.edu)
  13523. Date: Mar 18 1991
  13524. Problem:
  13525. I'm having trouble with a weakness constraint, and I don't understand it.
  13526. I have a function at top-level of a module, which the typechecker gives
  13527. the type
  13528.  
  13529.     val attach : 'aU CML.chan * widget_t * mbutton_t * 'aU menu_t -> widget_t
  13530.  
  13531. My memory is that the 'aU is an internal type variable?  Anyway, attach
  13532. calls another function taht also has an 'aU in its type; by adding a
  13533. type constraint to the other function, then things compile.  Anyway,
  13534. this seems like a bug (and I think I've run into it before).
  13535. Code:
  13536. Transcript:
  13537. Comments:
  13538. Here is a smaller example that triggers the bug.  The offending line is
  13539. marked by "(** THIS DOESN'T WORK **)"
  13540.  
  13541.  
  13542. signature INTERNAL_CML =
  13543.   sig
  13544.     type 'a event
  13545.     val sync : 'a event -> 'a
  13546.   end
  13547.  
  13548. functor ConcurML () : INTERNAL_CML =
  13549.   struct
  13550.  
  13551.     exception Never and Escape
  13552.     exception Sync (* for signature compatability *)
  13553.  
  13554.     datatype evt_sts = EVT_ANY | EVT_READY | EVT_BLOCK
  13555.  
  13556.     type 'a base_evt = {
  13557.         pollfn : unit -> evt_sts,
  13558.         dofn : unit -> 'a,
  13559.         blockfn : bool ref -> 'a
  13560.       }
  13561.  
  13562.     datatype 'a event = EVT of 'a base_evt list
  13563.  
  13564.     local
  13565.       datatype 'a ready_evts
  13566.         = NO_EVTS                               (* no ready events *)
  13567.         | ANY_EVTS of (int * (unit -> 'a) list) (* list of ready anyevents *)
  13568.         | RDY_EVTS of (int * (unit -> 'a) list) (* list of ready events *)
  13569.  
  13570.       fun extract _ = NO_EVTS
  13571.  
  13572.     (* Generate index numbers for "non-deterministic" selection.  We use a
  13573.      * round-robin style policy. *)
  13574.       val cnt = ref 0
  13575.       fun random i = let val j = !cnt in cnt := j+1; (j mod i) end
  13576.       fun selectEvt (_, [f]) = f()
  13577.         | selectEvt (n, l) = (nth(l, random n)) ()
  13578.     in
  13579.  
  13580.   (* sync : 'a event -> 'a *)
  13581.     fun sync (EVT []) = raise Never (** THIS DOESN'T WORK **)
  13582.     (*fun sync ((EVT []) : 'a event) = raise Never*)  (** THIS WORKS **)
  13583.       | sync (EVT el) = (
  13584.           case (extract el)
  13585.            of NO_EVTS => callcc (fn sync_k => let
  13586.                 val evtflg = ref false
  13587.                 fun log ({blockfn, ...} : 'a base_evt)=
  13588.                       (throw sync_k (blockfn evtflg)) handle Escape => ()
  13589.                 in
  13590.                   app log el;
  13591.                   (*atomicDispatch()*) raise Sync
  13592.                 end)
  13593.             | ANY_EVTS anyevts => selectEvt anyevts
  13594.             | RDY_EVTS evts => selectEvt evts)
  13595.  
  13596.     end (* local *)
  13597.  
  13598.   end (* functor ConcurML *)
  13599. Comment:  This is really the way that user-bound type variables are 
  13600.           supposed to work!
  13601. Status: not a bug
  13602. ---------------------------------------------------------------------------
  13603. 396. unbound variables should have type ERRORty
  13604. Submitter: Dave MacQueen (dbm@research.att.com)
  13605. Date: May 7 1991
  13606. Version: 0.66?
  13607. Severity: minor
  13608. Problem:
  13609. An unbound variable should have type ERRORty rather than UNDEFty so that
  13610. spurious secondary errors can be avoided.  E.g.
  13611.  
  13612. foo 3;
  13613. Error: unbound variable foo
  13614. Error: operator is not a function
  13615.   operator: undef
  13616.   in expression
  13617.     foo 3
  13618.  
  13619. Status: fixed (as of 0.69)
  13620. ---------------------------------------------------------------------------
  13621. 397. Unsafe.update with constant
  13622. Submitter: Andrew Tolmach (apt@princeton.edu)
  13623. Date: Mar 18 1991
  13624. Version: 0.69
  13625. System: Mips
  13626. Severity: critical
  13627. Problem:
  13628. from Appel:
  13629. Andrew Tolmach discovered the following bug, and I've tracked it down.
  13630. Unsafe.update is unreliable on the MIPS when the value stored is a constant.
  13631. (The same temporary is used twice in mips.sml).  I'll fix this for the
  13632. next version; in the meantime, use Array.update.
  13633. Code:
  13634. Transcript:
  13635. Comments:
  13636. [jgm]
  13637. This is probably causing the bug in the signal handling routines.
  13638. See bug 384
  13639. Fix: Appel and Tolmach have the fix, will install in 0.70
  13640. Status: fixed in 0.70
  13641. ---------------------------------------------------------------------------
  13642. 398. use and pathnames
  13643. Submitter: ark
  13644. Date: May 13 1991
  13645. Version: 0.66
  13646. Severity: minor
  13647. Problem:
  13648. A reminder: SML still doesn't interpret pathnames in "use"
  13649. calls relative to the correct directory.
  13650. Comments:
  13651.   Should be taken over by sourcegroup mechanisms.
  13652. Fix:  make "use" accumulate filepaths (using filepaths.sig)
  13653. Status: open
  13654. ---------------------------------------------------------------------------
  13655. 399. Vax dumps core
  13656. Submitter: David Tarditi (dtarditi@cs.cmu.edu)
  13657. Date: Mar 14 1991
  13658. Version: 0.67
  13659. System: Vax
  13660. Severity: critical
  13661. Problem:
  13662. The following piece of code causes version 0.67 of the compiler
  13663. to dump core on Vaxes running Mach:
  13664.  
  13665. - val s = "a";
  13666. - s;
  13667. Segmentation fault (core dumped)
  13668. Code:
  13669. Transcript:
  13670. Comments:
  13671. Fix: 
  13672. Status: fixed in 0.69
  13673. ---------------------------------------------------------------------------
  13674. 400. problem parsing weak types
  13675. Submitter:      John Ophel  jlophel@watmsg.waterloo.edu
  13676. Date:           9/11/90
  13677. Version:        0.66
  13678. System:         Vax, Unix
  13679. Severity:       minor
  13680. Problem:        weak type variables incorrectly parsed
  13681. Transcript:
  13682.  
  13683. - fun f (x:'10000000a) = x;
  13684. val f = fn : 'a -> 'a
  13685.  
  13686. - fun f (x:'10000001a) = x;
  13687. std_in:1.5-1.24 Error: pattern and constraint don't agree (weakness violation)
  13688.   pattern:    'Z
  13689.   constraint: '10000001aU
  13690.   in pattern:
  13691.     x : '10000001aU
  13692. Fix:  In mkUBOUND (basics/typesutil.sml), weakness of more than 900000 
  13693. should be illegal.  Also note that the type variable '10000000000000a
  13694. will cause an uncaught Overflow, which should be caught in this function.
  13695. Status: fixed in 0.71
  13696. ---------------------------------------------------------------------------
  13697. 401. Imperative types in SML/NJ 0.66
  13698. Submitter: Dave Berry <db@lfcs.edinburgh.ac.uk>
  13699. Date: 14 Feb 91 
  13700. Version: 0.66
  13701. System:
  13702. Severity: 
  13703. Problem: 
  13704. The following program compiles under Poly/ML 1.86, but fails to compile
  13705. under SML/NJ 0.66.
  13706.  
  13707.  
  13708. fun create (x:int) (y:'_a) :'_a Array.array = Array.array (x, y)
  13709.  
  13710. type ('a,'b) table = ('a*int*'b) list Array.array
  13711.  
  13712. val defaultSize = 97
  13713.  
  13714. fun createDefault (sample'value :'_a) :(string, '_a) table =
  13715.   let val mt = [] : (string * int * '_a) list
  13716.   in create defaultSize mt
  13717.   end
  13718.  
  13719.  
  13720. It will compile if Array.array is used directly in place of the curried
  13721. version.  It will also compile if createDefault is given an extra parameter,
  13722. either before or after the existing one.
  13723.  
  13724. This is the simplest example I've run across of SML/NJ failing to type
  13725. correct SML use of imperative types. It's fairly simple in this case -
  13726. it only took me a day to get the case this simple - but I've come across
  13727. at least one other example that I've just given up on.
  13728.  
  13729. I remember Dave MacQueen and mads Tofte discussing a bug in the SML/NJ
  13730. algorithm at the Edinburgh Workshop.  Is there any chance of a fix?
  13731.  
  13732. Dave.
  13733.  
  13734.  
  13735. From: jhr@cs.cornell.edu (John Reppy)
  13736. This problem was pointed out by Jim O'Toole.  Anyway, it was fixed
  13737. in 0.67:
  13738.  
  13739.   Standard ML of New Jersey, Version 0.68-JHR, January 25, 1991
  13740.   val it = () : unit
  13741.   - fun create (x:int) (y:'_a) :'_a Array.array = Array.array (x, y)
  13742.   = type ('a,'b) table = ('a*int*'b) list Array.array
  13743.   = val defaultSize = 97
  13744.   = fun createDefault (sample'value :'_a) :(string, '_a) table =
  13745.   = let val mt = [] : (string * int * '_a) list
  13746.   = in create defaultSize mt
  13747.   = end;
  13748.   val create = fn : int -> '1a -> '1a array
  13749.   type ('a,'b)  table = ('a * int * 'b) list array
  13750.   val defaultSize = 97 : int
  13751.   val createDefault = fn : '1a -> (string,'1a) table
  13752.   - 
  13753. Status: fixed (as of 0.67)
  13754. ---------------------------------------------------------------------------
  13755. 402. local non-declarations
  13756. Submitter:      Bernard Berthomieu (bernard@laas.laas.fr)
  13757. Date:        30/1/90
  13758. Version:        0.66
  13759. System:         SUN Sparstation 1+, SunOS 4.0.3c
  13760. Severity:       minor
  13761. Problem:        some declarations not accepted
  13762. Code:           local val x = 5 in 20 + x end;
  13763. Transcript:     - local val x = 5 in 20 + x end;
  13764.         std_in:1.21 Error: syntax error found at INT
  13765. Comments:    Not sure this is a bug, but the SML documents are not clear
  13766.         about this. According to my interpretation of the standard
  13767.         grammar, this declaration should be equivalent to the following:
  13768.         - local val x = 5 in val it = 20 + x end;
  13769.         val it = 25 : int
  13770. Fix:  expressions are considered as declarations ONLY at top level.
  13771. Status: not a bug
  13772. -------------------------------------------
  13773. 403. 0.0/0.0 not properly handled
  13774. Submitter:      Bernard Berthomieu (bernard@laas.laas.fr)
  13775. Date:        30/1/90
  13776. Version:        0.66
  13777. System:         SUN Sparstation 1+, SunOS 4.0.3c
  13778. Severity:       minor
  13779. Problem:        0.0/0.0 not properly handled
  13780. Code:           0.0/0.0
  13781. Transcript:     - 0.0/0.0;
  13782.         strange floating point error        (* and sml exits *)
  13783. Comments:    0.0/0.0 is generally considered in implementations 
  13784.         of reals as an "invalid operation" rather than a "division
  13785.         by zero" (exception code FPE_FLTOPERR_TRAP on SUNs OS 4.0).
  13786.         I did not checked the effect of 0.0/0.0 on other targets
  13787.         than SUN 4s, but it might have strange effects too;
  13788. Fix:
  13789. Status: fixed (as of 0.69)
  13790. ---------------------------------------------------------------------------
  13791. 404. std_out not flushed on read from std_in
  13792. Submitter:    Kim Dam Petersen  (kimdam@sun.tfl.dk)
  13793. Date:        June 1991
  13794. Version:        0.66
  13795. System:         all
  13796. Severity:       minor
  13797. Problem:        std_out not flushed on read from std_in
  13798. Comments:
  13799.  As printing on the standard output and error streams usually are
  13800.  flushed automatically I would suggest that this should be part of the
  13801.  standard behaviour of these stream.
  13802.  
  13803.  It seems that NJ/ML delays output flushing until the computation of a
  13804.  top level expression has completed.  As mentioned above flushing
  13805.  should be performed immediately.  A temporary solution in NJ/ML is
  13806.  to redefine the `output' function, such that the predefined
  13807.  `flush_out' is automatically called:
  13808.  
  13809.       val output = fn(s,t) => (output(s,t); flush_out s)
  13810.  
  13811.  Future call of `output' will print the text immediately.
  13812. Status: fixed in 0.71
  13813. ---------------------------------------------------------------------------
  13814. 405. identifiers starting with underscores are incorrectly allowed
  13815. Submitter: Mick Francis (Abstract Hardware)
  13816. Date:        August 1991
  13817. Version:        0.66
  13818. System:         all
  13819. Severity:       minor
  13820. Problem:        identifiers starting with underscores are incorrectly allowed
  13821. Status: fixed in 0.73
  13822. ---------------------------------------------------------------------------
  13823. 406. funny signatures in 0.71
  13824. Submitter: John Reppy
  13825. Date:        August 1991
  13826. Version:        0.71
  13827. System:         all
  13828. Severity:       minor
  13829. Problem:        Array.tabulate and String.chr have wrong types
  13830.         in initial environment
  13831. Status: fixed in 0.73
  13832. ---------------------------------------------------------------------------
  13833. 407. create_v_v for SPARC
  13834. Submitter:      Juergen Buntrock TUB, jubu@cs.tu-berlin.de 
  13835. Date: Tue Sep 24 19:23:13 MET DST 1991
  13836. Version: 0.73
  13837. System:           sun4c SUNOS 4.1.1 
  13838. Severity:       major
  13839. Problem:
  13840.         The mask is not set in create_v_v (SPARC.prim.s)
  13841.         segmentation fault
  13842.         in collect_roots in callgc.c
  13843. Fix:
  13844. diff -c SPARC.prim.s.org SPARC.prim.s
  13845.  
  13846. *** SPARC.prim.s.org    Fri Aug 23 20:33:54 1991
  13847. --- SPARC.prim.s        Tue Sep 24 19:11:30 1991
  13848. ***************
  13849. *** 476,481 ****
  13850. --- 476,483 ----
  13851.         nop
  13852.   4:
  13853.         CONTINUE
  13854. +       .word   closmask                /* reg. mask */
  13855. +       .word   0
  13856.  
  13857.   3:
  13858.         add     %g0,0,%g0               /* nop to get PC adjust right */
  13859.  
  13860. Status: Fixed in 0.74
  13861. ---------------------------------------------------------------------------
  13862. 408. feedback from module system
  13863. Submitter:      tmb@ai.mit.edu
  13864. Date:           08/03/91
  13865. Version:        0.70
  13866. System:         Sun4/OS4.1.1
  13867. Severity:       cosmetic, but important
  13868.  
  13869. I have been playing around with building functors that abstract
  13870. various notions of "iteration", "array", "sequence", and "index"
  13871. (ultimately, this will hopefully provide a nicer alternative to the
  13872. equivalent data structures in the current SML library).
  13873.  
  13874. In general, using the ML module and type system for this seems
  13875. straightforward and natural, and I'm much more pleased with the way I
  13876. can design this code in SML than with similar code that I have written
  13877. in Scheme, CommonLisp, and C++.
  13878.  
  13879. However, I have also come across some cosmetic but (to me) important
  13880. problems with the NJ/SML module system.
  13881.  
  13882. Some of the problems are that the system isn't telling me enough about
  13883. the identity of objects to allow me to debug the code without having
  13884. to guess much; something analogous to the LispMachine inspector and
  13885. mouse sensitivity would ultimately be very useful, but for the time
  13886. being, just reporting unique tags for objects instead of "?"  would be
  13887. sufficient.
  13888.  
  13889. Some of this might also be a question of style, but my ignorance is
  13890. partially due to the fact that the only uses of the module system that
  13891. I have seen have been rather simple and straightforward (even if they
  13892. involve lots of code).
  13893.  
  13894. I'd appreciate your feedback.
  13895.  
  13896.                         Thanks, Thomas.
  13897.  
  13898. PS: I can send you the complete code if you are interested, but
  13899. it is still more of a sketch or prototype.
  13900.  
  13901. = 1 ================================================================
  13902.  
  13903. I have a functor which generates iteration constructs for some data
  13904. type that it is handed (e.g., it generates "fold", "apply", etc. for
  13905. lists and arrays). It is very confusing that the types that the system
  13906. reports for the functions generated by this functor involve types of
  13907. the form "('a,'b) value" and "('a,'b) index". It would be much better
  13908. if the types were reported in their true form.
  13909.  
  13910.    signature S = sig type ('a,'b) data end;
  13911.    functor F(structure X:S) = struct fun f(x:('a,'b) X.data):('a,'b) X.data = x end;
  13912.    structure A = struct type ('a,'b) data = 'b list end;
  13913.    structure B = F(structure X=A);
  13914.  
  13915.    - B.f([1]);
  13916.    val it = [1] : ('a,int) A.data
  13917.    -
  13918.  
  13919. What I would want is:
  13920.  
  13921.    - B.f([1]);
  13922.    val it = [1] : int list
  13923.    -
  13924.  
  13925. Obviously, which form one wants depends on the exact use that a
  13926. functor is going to be put to. There should be a mechanism for me to
  13927. specify in the type binding which form of reporting I prefer.
  13928.  
  13929. = 2 ================================================================
  13930.  
  13931. Another problem that I have encountered is that it is nearly
  13932. impossible to figure out what goes wrong with complicated functor
  13933. applications with the current level of reporting: elements of
  13934. intermediate structures are now often only reported as
  13935. "?.KeyIndexing.foo", and it isn't helpful if the compiler tells you
  13936. that "?.KeyIndexing.foo" is a different type from "?.KeyIndexing.foo".
  13937.  
  13938. It would be much more convenient if there was an option to the
  13939. compiler that would trace and report functor applications, and if the
  13940. printer gave unique identities to structures, even temporary ones.
  13941.  
  13942. Something like:
  13943.  
  13944.    - use "foo";
  13945.    [Applying functor F<10> to structure <1001> giving structure <347> bound to structure T]
  13946.    [Applying functor G<11> to structure <66> giving structure <67> bound to structure T.M]
  13947.    [Applying functor G<11> to structure <33> giving structure <68> bound to structure T.M]
  13948.    - T.i;
  13949.    val it = SOMETHING : <11>.my_type;
  13950.    -
  13951.  
  13952. Printing unique ID's for structures (and, for that matter, for other
  13953. objects) shouldn't be hard, and it makes debugging so much easier.
  13954.  
  13955. = 3 ================================================================
  13956.  
  13957. When writing signatures for functors that generate polymorphic
  13958. functions, I seem to have to define types that carry around one type
  13959. variable for each polymorphic type, e.g.:
  13960.  
  13961. signature BASICACCESS =
  13962.     sig
  13963.     type ('a,'b) point
  13964.     type ('a,'b) value
  13965.     type ('a,'b) index
  13966.     type ('a,'b) range
  13967.     val first: ('a,'b) range -> ('a,'b) index
  13968.     val succ: ('a,'b) index -> ('a,'b) index
  13969.     val done: ('a,'b) index -> bool
  13970.     val mkindex: ('a,'b) point * ('a,'b) range -> ('a,'b) index
  13971.     val at: ('a,'b) index -> ('a,'b) value
  13972.     end;
  13973.  
  13974. Most of the polymorphic functions that get generated from BASICACCESS
  13975. structures will never need both type variables, while others may need
  13976. more than two.
  13977.  
  13978. For example,
  13979.  
  13980. structure BasicListIndex =
  13981.     struct
  13982.     type ('a,'b) point = 'a list
  13983.     type ('a,'b) value = 'a
  13984.     type ('a,'b) index = 'a list
  13985.     type ('a,'b) range = 'a list
  13986.     fun first x = x
  13987.     val succ = tl
  13988.     val done = null
  13989.     fun mkindex(x,y) = x
  13990.     fun at x = System.Unsafe.cast (hd x)  (* bug in NJSML .70 type checker ? *)
  13991.     end;
  13992.  
  13993. structure BasicArrayIndex =
  13994.     struct
  13995.     type ('a,'b) point = int
  13996.     type ('a,'b) index = int * int
  13997.     type ('a,'b) range = int
  13998.     fun first(limit:('a,'b) range):('a,'b) index = (0,limit)
  13999.     fun succ((x,limit):('a,'b) index):('a,'b) index = (x+1,limit)
  14000.     fun done((x,limit):('a,'b) index):bool = x>=limit
  14001.     fun at x = x
  14002.     fun mkindex(x,r) = (x,r)
  14003.     fun index1((x,_):('a,'b) index) = x
  14004.     end;
  14005.  
  14006. Carrying around the dummy type variables on types like "('a,'b) point"
  14007. is a bother. Perhaps a simple solution would be to allow the user to
  14008. omit type variables if they are specified as wildcards, e.g., "type
  14009. ('_,'_) point = int" can be used simply as "val x : point" with the
  14010. compiler inserting the missing (wildcard) type variables by
  14011. convention.
  14012.  
  14013. More generally, it would seem to be nice if type constructors could
  14014. take variable numbers of arguments, and if they could pass their
  14015. argument lists around as complete entities (analogous to passing
  14016. around tuples of arguments in ML).
  14017.  
  14018. Another possibility would be to allow "free" type variables:
  14019.  
  14020.    type point = '_ list
  14021.  
  14022. This would simply be syntactic sugar for
  14023.  
  14024.    type 'a point = 'a list
  14025.  
  14026. and the compiler would implicitly provide a dummy argument to "point"
  14027. wherever it is used. However, this may break other parts of the type
  14028. or module system.
  14029.  
  14030.     Point 3 is really about a basic problem with the current
  14031.     way signatures and functors handle types, not about "'_". 
  14032.  
  14033.     Essentially, I want to write functors that generate objects
  14034.     that are polymorphic in different ways, e.g., that sometimes
  14035.     generate a function "f : 'a -> 'a" and sometimes "f : 'a -> 'b".
  14036.  
  14037.     The only way I could find of writing signatures for such functors is to
  14038.     make both the LHS and the RHS types (e.g.  type ('a,'b) arg; type
  14039.     ('a,'b) result) that depend on two type variables and instantiate them
  14040.     in the matching structures to the correct types. This causes a number
  14041.     of problems that I mentioned in my previous message.
  14042.  
  14043.     Another possibility would be to allow a function of type "'a -> 'a"
  14044.     to match a type specification "'a -> 'b", but that does not
  14045.     currently work.
  14046.  
  14047.     Functors that generate functions that are polymorphic
  14048.     in different ways are very important, and, one way or another,
  14049.     SML must make this more convenient than it is right now.
  14050.  
  14051.                     Thanks, Thomas.
  14052. = 4 ================================================================
  14053.  
  14054. A related problem is that nongeneric weak type variables
  14055. generate an error even if they are never used:
  14056.  
  14057.    - val x: '0a t = 3;
  14058.    std_in:3.1-3.16 Error: nongeneric weak type variable
  14059.      x : '0aU t
  14060.    -
  14061.  
  14062. I think you can guess from the above structures and functors
  14063. how such non-generic weak type variables can pop up unexpectedly
  14064. (they are easy to fix for the user, by simply giving a type
  14065. to the value, but it seems odd for a user of, say structure
  14066. "Array2D" to have to specify some type as "(unit,int) array"
  14067. just to create an array of type "int array").
  14068.  
  14069. = 5 ================================================================
  14070.  
  14071. A minor problem with wildcard type variables:
  14072.  
  14073. - type ('_,'_) a;
  14074. std_in:7.7-7.11 Error: duplicate type variable: '1
  14075. std_in:7.7-7.11 Error: duplicate type variable: '1
  14076. std_in:7.7-7.11 Error: duplicate type variable: '1
  14077. std_in:7.7-7.11 Error: duplicate type variable: '1
  14078. std_in:7.7-7.11 Error: duplicate type variable: '1
  14079.  
  14080. I think the "'_" should refer to a new type variable every time it is
  14081. used (this is, after all, what "_" does in ML).
  14082.  
  14083. Followup discussion:
  14084.  
  14085.     Dave MacQueen writes:
  14086.      > What you are looking for may be rather difficult to do within the
  14087.      > framework of the ML type system.  At first glance it appears to
  14088.      > require a serious innovation in the type system to capture an
  14089.      > abstraction that could instantiate to both "f : 'a -> 'a" and
  14090.      > "f : 'a -> 'b" (note that these two types have different numbers of
  14091.      > bound variables).
  14092.      > 
  14093.      > Do you have any suggestions as to how this could be done?
  14094.  
  14095.     I believe it is possible to express type constraints like this
  14096.     with SML:
  14097.  
  14098.     signature S =
  14099.     sig
  14100.         type ('a,'b) from
  14101.         type ('a,'b) to
  14102.         val f : ('a,'b) from -> ('a,'b) to
  14103.     end;
  14104.  
  14105.     structure X:S =
  14106.     struct
  14107.         type ('a,'b) from = 'a
  14108.         type ('a,'b) to = 'a
  14109.         fun f(x) = x
  14110.     end;
  14111.  
  14112.     structure Y:S =
  14113.     struct
  14114.         type ('a,'b) from = 'a * 'b
  14115.         type ('a,'b) to = 'a
  14116.         fun f(x,y) = x
  14117.     end;
  14118.  
  14119.     (These are actually not accepted by NJ/SML 0.70, even if the types for
  14120.     "f" are fully specified in the structure definitions (you get a
  14121.     different error message in that case), but I think that's a bug.)
  14122.  
  14123.     The main problem is that this use of types in signatures seems to have
  14124.     been rather uncommon so far, so, at least NJ/SML has several
  14125.     difficulties with it:
  14126.  
  14127.      * the type checker/module system (incorrectly?) rejects
  14128.        some constructs like this
  14129.  
  14130.      * unused type variables need to be instantiated by
  14131.        the user when they become weak; instead, the
  14132.        language could automatically define such variables to
  14133.        be "unit"
  14134.  
  14135.      * the type constructors "from" and "to" are really
  14136.        auxilliary, and users of S most likely never want
  14137.        to see them printed; the current system prints them
  14138.  
  14139.      * the writer of the signature "S" has to pick a maximum
  14140.        number of auxilliary type variables used as arguments
  14141.        to "from" and "to", but I believe that the actual maximum
  14142.        number needed depends on the arguments given to the functor,
  14143.        not on the functor itself
  14144.  
  14145.     I want to state again that I think this feature is important. Without
  14146.     the ability to specify signatures that can match structures that are
  14147.     polymorphic in different ways, it seems I would have to write
  14148.     completely redundant versions of some functors.
  14149.  
  14150.     The context in which it came up was writing a functor that generates
  14151.     iteration constructs for collections; for some collections, indexes
  14152.     and values are different types, for others, they are the same type.
  14153.  
  14154. Status: not a bug
  14155. ---------------------------------------------------------------------------
  14156. 409. type checking after functor application
  14157. Submitter:      tmb@ai.mit.edu
  14158. Date:           08/05/91
  14159. Version:        0.70
  14160. System:         Sun4/OS4.1.1
  14161. Severity:       ?
  14162. Problem:
  14163.  
  14164. Basically, I have something like:
  14165.  
  14166. functor F(...) =
  14167.     struct
  14168.         structure A = G(...);
  14169.         ...
  14170.         open A
  14171.     end;
  14172.  
  14173. structure X = F(...);
  14174.  
  14175. X.A.f arg;               --> works
  14176. X.f arg;                 --> fails with a type error
  14177.  
  14178. Comment:
  14179.  
  14180. X.A.f and X.f must refer to the same value with the same type: A has
  14181. simply been opened at the end of structure X. I don't see how X.f
  14182. could ever behave differently from X.A.f.
  14183.  
  14184. Sorry about the long code needed to reproduce the bug. I had several
  14185. guesses what the problem might be due to, but I have not been able
  14186. to reduce the code further than this. In particular, the problem
  14187. goes away if the last functor application is removed, i.e.,
  14188.  
  14189.    functor GeneralArray(structure Index:BASICACCESS) = struct ... end;
  14190.    structure Arrays = GeneralArray(structure Index = BasicArrayIndex);
  14191.  
  14192. is replaced with
  14193.  
  14194.    structure Arrays =
  14195.        struct
  14196.            structure Index:BASICACCESS = BasicArrayIndex
  14197.            ... body of functor GeneralArray ...
  14198.        end
  14199.  
  14200. Also, don't try to make sense of the code. To isolate the bug this
  14201. far, I collapsed several types.
  14202.  
  14203. Code: (file foo.sml)
  14204.   signature BASICACCESS =
  14205.       sig
  14206.       type ('a,'b) index
  14207.       type ('a,'b) range
  14208.       val first: ('a,'b) range -> ('a,'b) index
  14209.       val succ: ('a,'b) index -> ('a,'b) index
  14210.       val done: ('a,'b) index -> bool
  14211.       end;
  14212.  
  14213.   functor GeneralIteration(structure Access:BASICACCESS) =
  14214.       struct
  14215.       local
  14216.           open Access
  14217.       in
  14218.           fun apply f r =
  14219.           let
  14220.               fun loop(i) = if done(i) then () else (f(i); loop(succ(i)))
  14221.           in
  14222.               loop(first(r))
  14223.           end
  14224.       end
  14225.       end;
  14226.  
  14227.   functor GeneralArray(structure Index:BASICACCESS) =
  14228.       struct
  14229.       type ('a,'b) array = 'b Array.array * ('a,'b) Index.range
  14230.  
  14231.       structure ValueIndex =
  14232.           struct
  14233.           type ('a,'b) range = ('a,'b) array
  14234.           type ('a,'b) index = 'b Array.array * ('a,'b)Index.index
  14235.           fun first((a,r):('a,'b) range) = (a,Index.first(r))
  14236.           fun succ((a,r):('a,'b) index) = (a,Index.succ(r))
  14237.           fun done((a,r):('a,'b) index) = Index.done(r)
  14238.           end
  14239.  
  14240.       structure Value = GeneralIteration(structure Access = ValueIndex)
  14241.  
  14242.       fun array(r:(unit,'1b) Index.range,initial):(unit,'1b) array =
  14243.           (Array.array(100,initial),r)
  14244.  
  14245.       open Value
  14246.       end;
  14247.  
  14248.   structure BasicArrayIndex =
  14249.       struct
  14250.       type ('a,'b) index = int * int
  14251.       type ('a,'b) range = int
  14252.       fun first(limit:('a,'b) range):('a,'b) index = (0,limit)
  14253.       fun succ((x,limit):('a,'b) index):('a,'b) index = (x+1,limit)
  14254.       fun done((x,limit):('a,'b) index):bool = x>=limit
  14255.       end;
  14256.  
  14257.   structure Arrays = GeneralArray(structure Index = BasicArrayIndex);
  14258.  
  14259. Transcript:
  14260. volterra$ sml
  14261. Standard ML of New Jersey, Version 0.70, 1 July 1991
  14262. val it = () : unit
  14263. - use "foo.sml";
  14264. [opening foo.sml]
  14265. signature BASICACCESS =
  14266.   sig
  14267.     type ('a,'b) index
  14268.     type ('a,'b) range
  14269.     val done : ('a,'b) index -> bool
  14270.     val first : ('a,'b) range -> ('a,'b) index
  14271.     val succ : ('a,'b) index -> ('a,'b) index
  14272.   end
  14273. functor GeneralIteration : <sig>
  14274. functor GeneralArray : <sig>
  14275. structure BasicArrayIndex :
  14276.   sig
  14277.     eqtype ('a,'b) index
  14278.     eqtype ('a,'b) range
  14279.     val done : ('a,'b) index -> bool
  14280.     val first : ('a,'b) range -> ('a,'b) index
  14281.     val succ : ('a,'b) index -> ('a,'b) index
  14282.   end
  14283. structure Arrays :
  14284.   sig
  14285.     structure Value : sig...end
  14286.     structure ValueIndex : sig...end
  14287.     eqtype ('a,'b) array
  14288.     val apply : (('a,'b) ?.ValueIndex.index -> 'c) -> ('a,'b) ?.ValueIndex.range
  14289.  -> unit
  14290.     val array : (unit,'1a) BasicArrayIndex.range * '1a -> (unit,'1a) array
  14291.   end
  14292. [closing foo.sml]
  14293. val it = () : unit
  14294. - val x = Arrays.array(100,0);
  14295. val x = (prim?,100) : (unit,int) Arrays.array
  14296. - Arrays.Value.Apply (fn a => a) x;
  14297. std_in:4.1-4.18 Error: unbound variable or constructor in structure: Apply
  14298. - Arrays.Value.apply (fn a => a) x;
  14299. val it = () : unit
  14300. - Arrays.apply (fn a => a) x;
  14301. std_in:2.1-2.26 Error: operator and operand don't agree (tycon mismatch)
  14302.   operator domain: ('Z,int) ?.ValueIndex.range
  14303.   operand:         (unit,int) Arrays.array
  14304.   in expression:
  14305.     Arrays.apply ((fn <pat> => <exp>)) x
  14306. - volterra$
  14307.  
  14308. Status: fixed in 0.73
  14309. ---------------------------------------------------------------------------
  14310. 410. inlining property not preserved in simple renaming
  14311. Submitter: Andrew Tolmach (apt@cs.princeton.edu)
  14312. Date: 8/6/91
  14313. Version: 0.73
  14314. Severity: minor
  14315. Problem: 
  14316.   If I use System.Unsafe.getvar directly, it is inlined, as expected.
  14317.  
  14318.   If I type
  14319.  
  14320.   val g = System.Unsafe.getvar
  14321.  
  14322.   then g does not have access INLINE.
  14323.  
  14324.   Dbm suggests that this is because g is being eta-expanded; I haven't found
  14325.   where this happens in the source.
  14326.  
  14327.   In any case, I don't know why the initial definition of
  14328.  
  14329.  
  14330.   val getvar = InLine.getvar
  14331.  
  14332.   inside the definition of System.Unsafe *does* manage to transfer the inline
  14333.   property...  Is it because there's something special about structure InLine?
  14334.  
  14335. Fix: look for MARKexps around the rhs VALvar.
  14336.   Tolmach: abstract syntax marking.  The MARKexps surrounding the RHS of
  14337.  
  14338.     val a = System.Unsafe.getvar
  14339.  
  14340.   prevent the INLINE-ness of getvar being recognized by parse/corelang.sml valbind.
  14341.   If I turn off marking, it works.
  14342.   Tarditi: We should alter parse/corelang.sml valbind so that it recognizes this
  14343.   case specially and properly assigns the INLINE property.
  14344.  
  14345. Status: fixed in 0.74
  14346. ---------------------------------------------------------------------------
  14347. 411. Runbind
  14348. Submitter: John Reppy (jhr)
  14349. Date: 8/10/91
  14350. Version: 0.71
  14351. Problem: Runbind exception
  14352. Transcript:
  14353.  
  14354.   Standard ML of New Jersey, Version 0.71, 23 July 1991
  14355.   val it = () : unit
  14356.   - structure A = struct val x = 1 end;
  14357.   structure A :
  14358.     sig
  14359.       val x : int
  14360.     end
  14361.   - structure B = struct structure A = A; val y = 2 end;
  14362.   structure B :
  14363.     sig
  14364.       structure A : sig...end
  14365.       val y : int
  14366.     end
  14367.   - open A;
  14368.   open A
  14369.   - open B;
  14370.   open B
  14371.   - x;
  14372.  
  14373.   uncaught exception Runbind
  14374.  
  14375. Status: fixed in 0.73
  14376. ---------------------------------------------------------------------------
  14377. 412. Runbind
  14378. Submitter: Dave Tarditi
  14379. Date: 8/13/91
  14380. Version: 0.71
  14381. Problem: 
  14382. Code: 
  14383.     structure A =
  14384.        struct
  14385.      val x = 5
  14386.      structure B = 
  14387.         struct
  14388.            val y = 5
  14389.         end
  14390.        end
  14391.  
  14392.     open A.B;
  14393.     structure A = struct end;
  14394.     y;
  14395. Comments: (Tarditi)
  14396.   There's an incorrect assumption in checkopen, which tests whether
  14397.   any value in a structure which has been rebound is still accessible.
  14398.   Let the old structure be called S and the new environment be N.  Let
  14399.   the symbols bound in the environment of S be T.   The assumption is
  14400.   that if any symbol A in T is unbound in N, then all other symbols
  14401.   in T are also unbound in N.  This is clearly untrue, as the above
  14402.   example shows, where x is unbound in the environment after the redefinition
  14403.   of A but y is not.
  14404.  
  14405. Status: fixed in 0.73
  14406. ---------------------------------------------------------------------------
  14407. 413. System and IO problems
  14408. Submitter: Emden Gansner
  14409. Date: 8/16/91
  14410. Version: 0.71
  14411. Problem: 
  14412.   The version of system in the System structure should have type string -> int
  14413.  
  14414.   The execute function in IO is incorrect as written. It passes the
  14415.   the value of environ() to exec, but this is a list of SML strings
  14416.   and exec expects a list of C strings. It should pass (map c_string environ())
  14417.   instead.
  14418.  
  14419.   Finally, the execute function would be a lot more useful if it allowed
  14420.   a list of arguments as well as program pathname.
  14421. Status: fixed in 0.74 (JHR)
  14422. ---------------------------------------------------------------------------
  14423. 414. getWD wrong
  14424. Submitter : Ian King <ik@sys.uea.ac.uk>
  14425. Date      : 19th August 1991
  14426. Version   : SML of New Jersey Version 0.66 , 15 September 1990
  14427. System    : Sun 3/160 , Sun OS 4.1
  14428. Severity  : Minor
  14429. Problem   : The function getWD in structure System.Directory when called 
  14430.             with a unit gives an incoorect result.
  14431. Code      : fun test path =
  14432.                 let
  14433.                    val cwd = System.Directory.getWD ()
  14434.                 in
  14435.                    { cd_in = fn () => (cd path),
  14436.                      cd_out = fn () => (cd cwd) }
  14437.                 end
  14438. Transcipt  : val {cd_in,cd_out} = test "directoryname";
  14439.                 val cd_in = fn : unit -> unit
  14440.                 val cd_out = fn : unit -> unit
  14441.  
  14442.              cd_in ();
  14443.                 val it = () : unit;
  14444.  
  14445.              cd_out ();
  14446.                 uncaught exception NotDirectory
  14447.  
  14448. Comments   : This code executes correctly on a Sun Sparc machine. It does not 
  14449.              execute correctly on our Sun 3/160. Although I have marked the
  14450.              bug as minor it is irritating because it crashes code which
  14451.              needs to change directories such as loaders.
  14452.          ** This is probably another example of bug #651 (JHR, 10/6/92) **
  14453. Status: fixed
  14454. ---------------------------------------------------------------------------
  14455. 415. late error detection in parsing
  14456. Submitter:      David N. Turner <dnt@dcs.ed.ac.uk>
  14457. Date:        17th September 1991
  14458. Version:        SML of NJ version 0.73
  14459. System:         Sun4
  14460. Severity:       minor
  14461. Problem:
  14462.  
  14463.     The following incorrect text doesn't generate an error,
  14464.     the secondary prompt appears and the error is only signalled
  14465.      after more text if typed in. Perhaps this is some kind of
  14466.     parser lookahead problem?
  14467.  
  14468.     - if true then 365;        (* My input     *)
  14469.     =                (* nj-sml output *)
  14470. Status: open
  14471. ---------------------------------------------------------------------------
  14472. 416. equality property checking in functor parameter matching
  14473. Submitter: Simon Finn <simon@abstract-hardware-ltd.co.uk>
  14474. Date: 9/13/91
  14475. Version: ?
  14476. Severity: minor
  14477. Problem: 
  14478. Try the following simple (?) exercise in semantics, provided by my
  14479. colleague Mike Crawley:
  14480.  
  14481.     signature PSIG =
  14482.     sig
  14483.       eqtype 'a symTab ;
  14484.           datatype guide = G1 | G2 of guide symTab
  14485.         end;
  14486.  
  14487. (Q1) Is guide an eqtype? (in PSIG)
  14488. (A1) Yes, since we require the equality-principal signature.
  14489.  
  14490.     functor PFUN (structure S : sig type 'a symTab end) =
  14491.     struct
  14492.       open S;
  14493.       datatype guide = G1 | G2 of guide symTab;
  14494.     end;
  14495.  
  14496. (Q2) Is guide an eqtype? (in the output signature of PFUN)
  14497. (A2) No, because symTab isn't and our signatures must respect equality
  14498.  
  14499.  
  14500.     structure S = struct datatype 'a symTab = Empty end;
  14501.     structure P = PFUN(structure S = S);
  14502.  
  14503. (Q3) Is guide an eqtype? (in the signature of P)
  14504. (A3) No, because it wasn't in the functor.
  14505.      Technically, this is because the realisation, \phi, used
  14506.      to instantiate the body of the functor doesn't touch
  14507.      the bound type names contained in the output signature
  14508.      of the functor (except, possibly, for an alpha-conversion).
  14509.      
  14510.     P.G1 = P.G1;
  14511.  
  14512. (Q4) Is this legal?
  14513. (A4) No, because P.guide is not an eqtype (see above).
  14514.  
  14515.     functor MFUN(structure X : PSIG) =
  14516.     struct
  14517.       val z = X.G1 = X.G1;
  14518.     end;
  14519.     structure M = MFUN(structure X = P);
  14520.  
  14521. (Q5) Is this legal?
  14522. (A5) No, because MFUN demands that guide be an eqtype (see Q1),
  14523.      but P.guide is not an eqtype (see Q3, Q4).
  14524.  
  14525.  
  14526. Both SMLNJ 0.66 and Poly/ML 1.88 get Q1 - Q4 right but get Q5 wrong.
  14527. Poly/ML 1.98 gets Q1 - Q5 right.
  14528.  
  14529. Comment: Conjecture that this is a benign bug.  Have not been able to
  14530.   come up with version that is actually wrong.
  14531.  
  14532. Fix: Could record equality properties inferred in parameter signature
  14533.      instantiation in the signature (memoizing).
  14534.  
  14535. Status: open
  14536. ---------------------------------------------------------------------------
  14537. 417. cosmetic error message suggestion
  14538. Submitter: Andy Koenig
  14539. Date: 9/12/91
  14540. Version: ?
  14541. Problem: 
  14542.   Minor suggestion for SML-NJ:  in error messages, how about
  14543.   printing infix functions as infix?
  14544.  
  14545. Transcript: 
  14546.   - 3 + 4.0;
  14547.   std_in:1.1-1.7 Error: operator and operand don't agree (tycon mismatch)
  14548.     operator domain: int * int
  14549.     operand:         int * real
  14550.     in expression:
  14551.       + (3,4.0)
  14552.       ^^^^^^^^^     Why not  3+4.0      ??
  14553.             or at least op+ (3,4.0)
  14554.  
  14555. Comment: use original code in error message instead of "pretty-printing"
  14556.   abstract syntax
  14557. Status: open
  14558. ---------------------------------------------------------------------------
  14559. 418. repeated type names in type declarations
  14560. Submitter:      Andrzej Filinski <andrzej@cs.cmu.edu>
  14561. Date:        September 11, 1991
  14562. Version:        0.72
  14563. System:         All
  14564. Severity:       minor (but with potentially serious consequences)
  14565. Problem:        Repeated type names in DATATYPE ... WITHTYPE ...
  14566.         destroy type security.
  14567. Transcript:     Standard ML of New Jersey, Version 0.72, 29 August 1991
  14568.         val it = () : unit
  14569.         - datatype t = T of int withtype t = string;
  14570.         datatype  t
  14571.         con T : int -> t
  14572.         type  t = string
  14573.         - T 65:string;
  14574.         val it = "A" : string
  14575.         -
  14576. Comments:    Same problem with ABSTYPE...WITHTYPE. See also bug report 349.
  14577.  
  14578. Status: fixed in 0.74
  14579. ---------------------------------------------------------------------------
  14580. 419. Runbind
  14581. Submitter:      Venkatesh Akella  akella@cs.utah.edu
  14582. Date:        8/27/91
  14583. Version:        SML of NJ version 0.71
  14584. System:         Sparc IPC, SunOS
  14585. Severity:       major
  14586. Problem:        Raises an uncaught exception Runbind when
  14587.         a simple CML program running under SML version 0.71
  14588.         (Version of CML being used is 0.95)
  14589.         The bug can't be reproduced with CML version 0.90 running
  14590.         under SML/NJ 0.66
  14591. Code:
  14592.  
  14593. fun placeBuffer () =
  14594.    let 
  14595.     val c = channel () 
  14596.     val b = channel () 
  14597.     val a = channel ()
  14598.     fun input_int (s:string) =
  14599.         fold (fn(a,r) => ord(a) - ord("0") + 10 * r) (tl (rev(explode s))) 0;
  14600.  
  14601.     fun P1 x   = (CIO.print( "Waiting for Input on Channel a? \n");
  14602.         let
  14603.             val y =  input_int(CIO.input_line std_in)
  14604.         in
  14605.             s__3 x y
  14606.         end)
  14607.     and 
  14608.          s__3 x y   = ( ( send (c,y ) ; P1 y  ))
  14609.  
  14610.     fun P2 z   = (let val v =  accept  c in s__5 z v  end)
  14611.     and 
  14612.          s__5 z v  =
  14613.     ( (CIO.print (" Output on Channel b!"^Integer.makestring(v)^"\n");
  14614.     P2 v  ))
  14615.    in 
  14616.      spawn (fn () => P1 4  );
  14617.      spawn (fn () => P2 5  );
  14618.     () 
  14619.       end;
  14620.  
  14621. Transcript:
  14622.  
  14623. 6 bliss /u/akella/compiler/cml/cml95/cml-0.9.5:: > cml
  14624. val it = true : bool
  14625. - System.Directory.cd "/u/akella/compiler/hop/example";
  14626. val it = () : unit
  14627. - use "test_buf.sml";
  14628. [opening test_buf.sml]
  14629. [closing test_buf.sml]
  14630.  
  14631. uncaught exception Runbind
  14632. -
  14633.  
  14634. Comments:
  14635.     The same bug was observed in SML/NJ version 0.66 too but in
  14636.     a different context. I had one integrated environment with
  14637.     SML 0.66, ML-yacc, ML-lex, CML(version 0.9) and my own code.
  14638.  
  14639. Status: fixed in 0.74
  14640. ---------------------------------------------------------------------------
  14641. 420. uncaught Nth while compiling
  14642. Submitter:    Tsung-Min Kuo    kuo@ecrc.de
  14643. Date:        Sep 19, 1991
  14644. Version:        Version 0.66, 15 September 1990
  14645. System:         SPARCstation 1, SUNOS 4.0
  14646. Severity:    sever
  14647. Problem:        Compiler-generated exception : uncaught exception Nth
  14648. Code:
  14649.     signature EXCHANGE_STRUCTURE =
  14650.     sig
  14651.        type tree 
  14652.        val new_node : tree -> tree
  14653.     end
  14654.     
  14655.     structure ex : EXCHANGE_STRUCTURE =
  14656.     struct
  14657.     datatype tree = Subwindow of subwindow
  14658.               | Canvas of canvas
  14659.               | Frame of frame
  14660.               | Baseframe of baseframe
  14661.               | NULL
  14662.     withtype subwindow = {t_node: tree}
  14663.     and canvas = {subwindow: subwindow}
  14664.     and frame = {tree_node: tree}
  14665.     and baseframe = {frame: frame,foog:bool} 
  14666.     
  14667.     exception Tube_Bug
  14668.     
  14669.     fun position (Canvas c) = position(Subwindow(#subwindow c))
  14670.       | position (Baseframe bf) = position(Frame (#frame bf))
  14671.       | position _ = raise Tube_Bug
  14672.     
  14673.     fun tn_set_position(t,p) = ()
  14674.     fun set_position (Subwindow sb) = tn_set_position(#t_node sb,0)
  14675.       | set_position (Frame f) = tn_set_position(#tree_node f,0)
  14676.       | set_position (Canvas c) = set_position(Subwindow(#subwindow c))
  14677.       | set_position (Baseframe bf) = set_position(Frame(#frame bf))
  14678.       | set_position _ = raise Tube_Bug
  14679.     
  14680.     fun components(Canvas c) = components(Subwindow (#subwindow c))
  14681.       | components(Baseframe bf) = components(Frame (#frame bf))
  14682.       | components _ = raise Tube_Bug
  14683.     
  14684.     fun bounding_box(Canvas c) = bounding_box(Subwindow (#subwindow c))
  14685.       | bounding_box(Baseframe bf) = bounding_box(Frame (#frame bf))
  14686.       | bounding_box _ = raise Tube_Bug
  14687.     
  14688.     fun tn_set_bounding_box(t,r) = ()
  14689.     fun set_bounding_box(Subwindow sb) = tn_set_bounding_box(#t_node sb,0)
  14690.       | set_bounding_box(Frame f) = tn_set_bounding_box(#tree_node f,0)
  14691.       | set_bounding_box(Canvas c) = set_bounding_box(Subwindow(#subwindow c))
  14692.       | set_bounding_box(Baseframe bf) = set_bounding_box(Frame(#frame bf))
  14693.       | set_bounding_box _ = raise Tube_Bug
  14694.     
  14695.     fun new_node tl =
  14696.        let
  14697.           val pos = position(Frame {tree_node = tl})
  14698.        in
  14699.           NULL
  14700.        end
  14701.     end
  14702.  
  14703. Transcript:
  14704.     - use "bug";
  14705.     [opening bug]
  14706.     [closing bug]
  14707.  
  14708.     uncaught exception Nth
  14709.     -
  14710. Comments: The enclosed code is a trimmed version of a big program, got in an
  14711.       attempt to isolate the error. As you can see, this program virtually
  14712.       does nothing and is full of redundancy. But whatever I did to try to
  14713.       cut it down, results in a good program happily accepted by compiler.
  14714.       Here are some of the things I have tried :
  14715.       * not use the signature constraint on the structure
  14716.       * delete any of the redundant function definitions, e.g."components"
  14717.       * remove the redundant call to function "position" in "new_node"
  14718.       * or, even call "position" with argument NULL
  14719.       * remove a clause from any function definition(I tried many of them)
  14720.       * flat the record, e.g. make type frame = tree
  14721.       * remove the boolean field in type "baseframe"
  14722.       * get rid of second argument of functions "tn_set_position" and
  14723.         "tn_set_bounding_box"
  14724.       * replace equal by equal, e.g. replace calls to "tn_set_position"
  14725.         by ()
  14726.       * replace recursive call by direct call, e.g. in "Canvas" clause of
  14727.         function "set_position"
  14728.     Conclusion: These are so diverse that I can not even guess any.
  14729.  
  14730. Status: fixed in 0.73
  14731. ---------------------------------------------------------------------------
  14732. 421. getWD under SPARC/Mach (same as 353)
  14733. Submitter: Fritz Knabe <Frederick_Knabe@ARCTIC.FOX.CS.CMU.edu>
  14734. Date: 9/18/91
  14735. Version: 0.73
  14736. System: SPARC/Mach (CMU)
  14737. Severity: minor
  14738. Problem: 
  14739.   System.Directory.getWD () is still broken for me in version 73
  14740.   on a Sparc. It raises a SystemCall exception.
  14741. Transcript: (c/o Gene Rollins, 8/21/92)
  14742. Standard ML of New Jersey, Version 0.88, August 14, 1992
  14743.   with SourceGroup 2.2 built on Mon Aug 17 23:23:16 EDT 1992
  14744. - fun pwd() = System.system "pwd";
  14745. val pwd = fn : unit -> int
  14746. - fun cd x = (System.Directory.cd x; pwd()) handle any => (pwd(); raise any);
  14747. val cd = fn : string -> int
  14748. - fun ll () = System.system "ls -lL";
  14749. val ll = fn : unit -> int
  14750. - fun mkdir x = System.system ("mkdir " ^ x);
  14751. val mkdir = fn : string -> int
  14752. - pwd();
  14753. /usr0/rollins
  14754. val it = 0 : int
  14755. - ll();
  14756. total 0
  14757. val it = 0 : int
  14758. - mkdir "src";
  14759. val it = 0 : int
  14760. - mkdir "bin";
  14761. val it = 0 : int
  14762. - ll();
  14763. total 2
  14764. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  14765. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  14766. val it = 0 : int
  14767. - cd "src";
  14768. /usr0/rollins/src
  14769. val it = 0 : int
  14770. - cd "../bin";
  14771. /usr0/rollins/bin
  14772. val it = 0 : int
  14773. - cd "../src";
  14774. /usr0/rollins/src
  14775. val it = 0 : int
  14776. - cd "..";
  14777. /usr0/rollins
  14778. val it = 0 : int
  14779. - cd "bin";
  14780. /usr0/rollins/bin
  14781. val it = 0 : int
  14782. - cd "..";
  14783. /usr0/rollins
  14784. val it = 0 : int
  14785. - ll();
  14786. total 2
  14787. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  14788. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  14789. val it = 0 : int
  14790. - mkdir "tools";
  14791. val it = 0 : int
  14792. - cd "src";
  14793. /usr0/rollins/src
  14794. val it = 0 : int
  14795. - cd "../tools";
  14796. /usr0/rollins/src
  14797.  
  14798. uncaught exception NotDirectory
  14799. - cd "../bin";
  14800. /usr0/rollins/bin
  14801. val it = 0 : int
  14802. - cd "../tools";
  14803. /usr0/rollins/bin
  14804.  
  14805. uncaught exception NotDirectory  (* the rest is more of the same *)
  14806. - cd "..";
  14807. /usr0/rollins
  14808. val it = 0 : int
  14809. - cd "tools";
  14810. /usr0/rollins/tools
  14811. val it = 0 : int
  14812. - cd "../src";
  14813. /usr0/rollins/src
  14814. val it = 0 : int
  14815. - cd "../tools";
  14816. /usr0/rollins/src
  14817.  
  14818. uncaught exception NotDirectory
  14819. - cd "..";
  14820. /usr0/rollins
  14821. val it = 0 : int
  14822. - ll();
  14823. total 3
  14824. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  14825. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  14826. drwxr-xr-x  2 rollins       512 Aug 20 12:17 tools
  14827. val it = 0 : int
  14828. - mkdir "mo.mipsl";
  14829. val it = 0 : int
  14830. - ll();
  14831. total 4
  14832. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  14833. drwxr-xr-x  2 rollins       512 Aug 20 12:18 mo.mipsl
  14834. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  14835. drwxr-xr-x  2 rollins       512 Aug 20 12:17 tools
  14836. val it = 0 : int
  14837. - cd "mo.mipsl";
  14838. /usr0/rollins
  14839.  
  14840. uncaught exception NotDirectory
  14841. - cd "src";
  14842. /usr0/rollins/src
  14843. val it = 0 : int
  14844. - cd "../mo.mipsl";
  14845. /usr0/rollins/mo.mipsl
  14846. val it = 0 : int
  14847. - cd "../tools";
  14848. /usr0/rollins/mo.mipsl
  14849.  
  14850. uncaught exception NotDirectory
  14851. - cd "../bin";
  14852. /usr0/rollins/bin
  14853. val it = 0 : int
  14854. - cd "../mo.mipsl";
  14855. /usr0/rollins/mo.mipsl
  14856. val it = 0 : int
  14857. - cd "..";
  14858. /usr0/rollins
  14859. val it = 0 : int
  14860. - cd "mo.mipsl";
  14861. /usr0/rollins
  14862.  
  14863. uncaught exception NotDirectory
  14864. - ll();
  14865. total 4
  14866. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  14867. drwxr-xr-x  2 rollins       512 Aug 20 12:18 mo.mipsl
  14868. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  14869. drwxr-xr-x  2 rollins       512 Aug 20 12:17 tools
  14870. val it = 0 : int
  14871. - mkdir "zed";
  14872. val it = 0 : int
  14873. - ll();
  14874. total 5
  14875. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  14876. drwxr-xr-x  2 rollins       512 Aug 20 12:18 mo.mipsl
  14877. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  14878. drwxr-xr-x  2 rollins       512 Aug 20 12:17 tools
  14879. drwxr-xr-x  2 rollins       512 Aug 20 12:23 zed
  14880. val it = 0 : int
  14881. - cd "zed";
  14882. /usr0/rollins/zed
  14883. val it = 0 : int
  14884. - cd "../tools";
  14885. /usr0/rollins/zed
  14886.  
  14887. uncaught exception NotDirectory
  14888. - cd "../src";
  14889. /usr0/rollins/src
  14890. val it = 0 : int
  14891. - cd "../zed";
  14892. /usr0/rollins/zed
  14893. val it = 0 : int
  14894. - cd "..";
  14895. /usr0/rollins
  14896. val it = 0 : int
  14897. - mkdir "moon";
  14898. val it = 0 : int
  14899. - cd "moon";
  14900. /usr0/rollins
  14901.  
  14902. uncaught exception NotDirectory
  14903. - cd "src";
  14904. /usr0/rollins/src
  14905. val it = 0 : int
  14906. - cd "../moon";
  14907. /usr0/rollins/moon
  14908. val it = 0 : int
  14909. - cd "..";
  14910. /usr0/rollins
  14911. val it = 0 : int
  14912. - ll();
  14913. total 6
  14914. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  14915. drwxr-xr-x  2 rollins       512 Aug 20 12:18 mo.mipsl
  14916. drwxr-xr-x  2 rollins       512 Aug 20 12:24 moon
  14917. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  14918. drwxr-xr-x  2 rollins       512 Aug 20 12:17 tools
  14919. drwxr-xr-x  2 rollins       512 Aug 20 12:23 zed
  14920. val it = 0 : int
  14921. - mkdir "tooth";
  14922. val it = 0 : int
  14923. - ll();
  14924. total 7
  14925. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  14926. drwxr-xr-x  2 rollins       512 Aug 20 12:18 mo.mipsl
  14927. drwxr-xr-x  2 rollins       512 Aug 20 12:24 moon
  14928. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  14929. drwxr-xr-x  2 rollins       512 Aug 20 12:17 tools
  14930. drwxr-xr-x  2 rollins       512 Aug 20 12:25 tooth
  14931. drwxr-xr-x  2 rollins       512 Aug 20 12:23 zed
  14932. val it = 0 : int
  14933. - cd "tooth";
  14934. /usr0/rollins/tooth
  14935. val it = 0 : int
  14936. - cd "../src";
  14937. /usr0/rollins/src
  14938. val it = 0 : int
  14939. - cd "../tooth";
  14940. /usr0/rollins/src
  14941.  
  14942. uncaught exception NotDirectory
  14943. - cd "..";
  14944. /usr0/rollins
  14945. val it = 0 : int
  14946. - ll();
  14947. total 7
  14948. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  14949. drwxr-xr-x  2 rollins       512 Aug 20 12:18 mo.mipsl
  14950. drwxr-xr-x  2 rollins       512 Aug 20 12:24 moon
  14951. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  14952. drwxr-xr-x  2 rollins       512 Aug 20 12:17 tools
  14953. drwxr-xr-x  2 rollins       512 Aug 20 12:25 tooth
  14954. drwxr-xr-x  2 rollins       512 Aug 20 12:23 zed
  14955. val it = 0 : int
  14956. - cd "mzz";
  14957. /usr0/rollins
  14958.  
  14959. uncaught exception NotDirectory
  14960. - mkdir "mzz";
  14961. val it = 0 : int
  14962. - cd "mzz";
  14963. /usr0/rollins/mzz
  14964. val it = 0 : int
  14965. - cd "../src";
  14966. /usr0/rollins/src
  14967. val it = 0 : int
  14968. - cd "../mzz";
  14969. /usr0/rollins/mzz
  14970. val it = 0 : int
  14971. - mkdir "me";
  14972. val it = 0 : int
  14973. - ll();
  14974. total 1
  14975. drwxr-xr-x  2 rollins       512 Aug 20 12:26 me
  14976. val it = 0 : int
  14977. - pwd();
  14978. /usr0/rollins/mzz
  14979. val it = 0 : int
  14980. - cd "..";
  14981. /usr0/rollins
  14982. val it = 0 : int
  14983. - mkdir "me";
  14984. val it = 0 : int
  14985. - ll();
  14986. total 9
  14987. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  14988. drwxr-xr-x  2 rollins       512 Aug 20 12:26 me
  14989. drwxr-xr-x  2 rollins       512 Aug 20 12:18 mo.mipsl
  14990. drwxr-xr-x  2 rollins       512 Aug 20 12:24 moon
  14991. drwxr-xr-x  3 rollins       512 Aug 20 12:26 mzz
  14992. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  14993. drwxr-xr-x  2 rollins       512 Aug 20 12:17 tools
  14994. drwxr-xr-x  2 rollins       512 Aug 20 12:25 tooth
  14995. drwxr-xr-x  2 rollins       512 Aug 20 12:23 zed
  14996. val it = 0 : int
  14997. - cd "me";
  14998. /usr0/rollins/me
  14999. val it = 0 : int
  15000. - cd "../tooth";
  15001. /usr0/rollins/me
  15002.  
  15003. uncaught exception NotDirectory
  15004. - cd "..";
  15005. /usr0/rollins
  15006. val it = 0 : int
  15007. - mkdir "teeth";
  15008. val it = 0 : int
  15009. - cd "teeth";
  15010. /usr0/rollins/teeth
  15011. val it = 0 : int
  15012. - cd "../src";
  15013. /usr0/rollins/src
  15014. val it = 0 : int
  15015. - cd "../teeth";
  15016. /usr0/rollins/src
  15017.  
  15018. uncaught exception NotDirectory
  15019. - cd "..";
  15020. /usr0/rollins
  15021. val it = 0 : int
  15022. - ll();
  15023. total 10
  15024. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  15025. drwxr-xr-x  2 rollins       512 Aug 20 12:26 me
  15026. drwxr-xr-x  2 rollins       512 Aug 20 12:18 mo.mipsl
  15027. drwxr-xr-x  2 rollins       512 Aug 20 12:24 moon
  15028. drwxr-xr-x  3 rollins       512 Aug 20 12:26 mzz
  15029. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  15030. drwxr-xr-x  2 rollins       512 Aug 20 12:27 teeth
  15031. drwxr-xr-x  2 rollins       512 Aug 20 12:17 tools
  15032. drwxr-xr-x  2 rollins       512 Aug 20 12:25 tooth
  15033. drwxr-xr-x  2 rollins       512 Aug 20 12:23 zed
  15034. val it = 0 : int
  15035. - mkdir "tzz";
  15036. val it = 0 : int
  15037. - ll();
  15038. total 11
  15039. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  15040. drwxr-xr-x  2 rollins       512 Aug 20 12:26 me
  15041. drwxr-xr-x  2 rollins       512 Aug 20 12:18 mo.mipsl
  15042. drwxr-xr-x  2 rollins       512 Aug 20 12:24 moon
  15043. drwxr-xr-x  3 rollins       512 Aug 20 12:26 mzz
  15044. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  15045. drwxr-xr-x  2 rollins       512 Aug 20 12:27 teeth
  15046. drwxr-xr-x  2 rollins       512 Aug 20 12:17 tools
  15047. drwxr-xr-x  2 rollins       512 Aug 20 12:25 tooth
  15048. drwxr-xr-x  2 rollins       512 Aug 20 12:27 tzz
  15049. drwxr-xr-x  2 rollins       512 Aug 20 12:23 zed
  15050. val it = 0 : int
  15051. - cd "tzz";
  15052. /usr0/rollins/tzz
  15053. val it = 0 : int
  15054. - cd "../src";
  15055. /usr0/rollins/src
  15056. val it = 0 : int
  15057. - cd "../tzz";
  15058. /usr0/rollins/tzz
  15059. val it = 0 : int
  15060. - cd "../teeth";
  15061. /usr0/rollins/tzz
  15062.  
  15063. uncaught exception NotDirectory
  15064. - cd "..";
  15065. /usr0/rollins
  15066. val it = 0 : int
  15067. - ll();
  15068. total 11
  15069. drwxr-xr-x  2 rollins       512 Aug 20 12:16 bin
  15070. drwxr-xr-x  2 rollins       512 Aug 20 12:26 me
  15071. drwxr-xr-x  2 rollins       512 Aug 20 12:18 mo.mipsl
  15072. drwxr-xr-x  2 rollins       512 Aug 20 12:24 moon
  15073. drwxr-xr-x  3 rollins       512 Aug 20 12:26 mzz
  15074. drwxr-xr-x  2 rollins       512 Aug 20 12:16 src
  15075. drwxr-xr-x  2 rollins       512 Aug 20 12:27 teeth
  15076. drwxr-xr-x  2 rollins       512 Aug 20 12:17 tools
  15077. drwxr-xr-x  2 rollins       512 Aug 20 12:25 tooth
  15078. drwxr-xr-x  2 rollins       512 Aug 20 12:27 tzz
  15079. drwxr-xr-x  2 rollins       512 Aug 20 12:23 zed
  15080. val it = 0 : int
  15081. Comment: (Lal George)
  15082.   There is an operating system level 3 call that can be used to
  15083.   get the working directory.
  15084.   Unfortunately, we cannot use this because it does a malloc.
  15085.   So we have to build up the working directory pathname by
  15086.   interpreting inodes.
  15087.   It is my guess that this is what bombs out in the Andrew file
  15088.   system.
  15089.   ** This is probably another example of bug #651 (JHR, 10/6/92) **
  15090. Status: fixed
  15091. ---------------------------------------------------------------------------
  15092. 422. overflow on int to real conversion
  15093. Submitter:      Andrzej Filinski <andrzej@cs.cmu.edu>
  15094. Date:        September 20, 1991
  15095. Version:        0.73
  15096. System:         all
  15097. Severity:       major
  15098. Problem:        int->real conversion overflows on MININT
  15099. Transcript:     Standard ML of New Jersey, Version 0.73, 10 September 1991
  15100.         Arrays have changed; see doc/NEWS
  15101.         val it = () : unit
  15102.         - ~0x40000000;
  15103.         val it = ~1073741824 : int
  15104.         - real it;    
  15105.  
  15106.         uncaught exception Overflow
  15107.         -    
  15108. Fix:        In boot/perv.sml, move redundant check for MININT
  15109.                 from Integer.mod to Real.real  :-).
  15110.  
  15111. Status: Fixed in 0.74
  15112. ---------------------------------------------------------------------------
  15113. 423. printing of structure signatures
  15114. Submitter: John Reppy
  15115. Date: 10/1/91
  15116. Version: 0.73
  15117. Severity: minor
  15118. Problem: 
  15119.   At top level, some structure signatures are printed as identifiers,
  15120.   while others are printed in full.
  15121. Transcript: 
  15122.   Standard ML of New Jersey, Version 0.73, 10 September 1991
  15123.   Arrays have changed; see doc/NEWS
  15124.   val it = () : unit
  15125.   - structure I = IO;
  15126.   structure I : IO
  15127.   - structure V = Vector;
  15128.   structure V : 
  15129.     sig
  15130.       eqtype 'a vector
  15131.       exception Size
  15132.       exception Subscript
  15133.       val length : 'a vector -> int
  15134.       val sub : 'a vector * int -> 'a
  15135.       val tabulate : int * (int -> 'a) -> 'a vector
  15136.       val vector : 'a list -> 'a vector
  15137.       val vector_n : int * 'a list -> 'a vector
  15138.     end
  15139.   - 
  15140. Comments: [Dave Tarditi]
  15141. The reported behavior is intentional: the basic idea is that if we know
  15142. the name of a structure's signature, we print the name of the signature
  15143. instead of the whole signature.
  15144.  
  15145. More formally, if S is structure which is bound to structure id SX,
  15146. and S was the result of doing a signature match against signature T,
  15147. which itself is bound to signature identifier TX, then when we print
  15148. the signature for the structure bound to SX, we will print TX, provided
  15149. that TX is still bound to the same signature.
  15150.  
  15151. Thus we get the following results at the top-level:
  15152.  
  15153. - structure S = IO;
  15154. structure S : IO
  15155. - structure T = S;
  15156. structure T : IO
  15157.  
  15158. but when we re-bind the signature identifier IO we get:
  15159.  
  15160. - signature IO = sig end;
  15161. signature IO =
  15162.   sig
  15163.   end
  15164. - structure S = IO
  15165. structure S =
  15166.   sig 
  15167.     type instream
  15168.   ...
  15169.   end
  15170.  
  15171. The problem is that the signature identifier VECTOR is not in 
  15172. the top-level environment.  To fix this, change
  15173. build/process.sml, lines 202-204 from:
  15174.  
  15175.            map Symbol.sigSymbol ["REF","LIST","ARRAY","BYTEARRAY","IO","BOOL",
  15176.                   "ENVIRON", "COMPILE", 
  15177.                          "STRING","INTEGER","REAL","GENERAL"]
  15178. to:
  15179.            map Symbol.sigSymbol ["REF","LIST","ARRAY","BYTEARRAY","IO","BOOL",
  15180.                   "ENVIRON", "COMPILE"
  15181.                          "STRING","INTEGER","REAL","GENERAL",
  15182.                              "VECTOR"]
  15183.  
  15184. Maybe we should add a flag to toggle this behavior, but I was hoping
  15185. that we would an environment browsing structure to the compiler
  15186. instead.  It's a kludge to have to type "structure S = S" to see the
  15187. signature of S.
  15188.  
  15189. Status: not a but (but a feature!)
  15190. ---------------------------------------------------------------------------
  15191. 424. IO.execute on SPARC
  15192. Submitter: Emden Gansner
  15193. Date: 10/1/91
  15194. Version: 0.73
  15195. System: SPARC, SunOS 4.1
  15196. Severity: moderate
  15197. Problem: 
  15198.     "I just noticed that, starting with 0.71, the IO.execute function
  15199.     causes problems on the sparc, running SunOS4.1. This problem 
  15200.     doesn't occur on 0.73 running on hunny."
  15201. Transcript: 
  15202.   t) /usr/addon/sml/bin/*69*
  15203.   Standard ML of New Jersey, Version 0.69, 3 April 1991
  15204.   val it = () : unit
  15205.   - IO.execute "/bin/date";
  15206.   val it = (-,-) : instream * outstream
  15207.   - t)
  15208.   t) sml
  15209.   Standard ML of New Jersey, Version 0.71, 23 July 1991
  15210.   val it = () : unit
  15211.   - IO.execute "/bin/date";
  15212.   /home/erg/bin/sml[7]: 6446 Bus error
  15213.   t) sml73
  15214.   Standard ML of New Jersey, Version 0.73, 10 September 1991
  15215.   val it = () : unit
  15216.   - IO.execute "/bin/date";
  15217.   Bus error
  15218.   t)
  15219. Status: fixed in 0.74 (JHR)
  15220. ---------------------------------------------------------------------------
  15221. 425. profiler flakiness
  15222. Submitter: Frank Pfenning
  15223. Date: 10/2/91
  15224. Version: 0.73
  15225. Problem: 
  15226.     I am currently in the process of eliminating obvious inefficiencies in an ML
  15227.   implementation of a logic programming language.  While using the profiler, I
  15228.   noticed that it seemed to lead to inordinately large core images during the
  15229.   development (there is also a small overhead for the mere fact that we are
  15230.   profiling, but that is acceptable).  My guess is the profiler keeps a
  15231.   (non-weak) pointer to code somehow, which prevents it from being garbage
  15232.   collected even if it is no longer accessible from the top-level.  The fact
  15233.   that redefined functions show up twice or more often in the profiling
  15234.   statistics seem to confirm that, but I may be using it wrong, or there could
  15235.   be other reasons.  I would be interested to hear what the
  15236.   developer/implementor of the profiler has to say about this.  Thanks,
  15237. Comment: (Andrew Appel)
  15238.   Yes, I think your analysis is correct.
  15239.   There's a profiler function that resets the profiler; perhaps that's
  15240.   what you want.  But if you use it, you'd have to reload your entire
  15241.   source code.
  15242. Status: fixed in 0.86
  15243. ---------------------------------------------------------------------------
  15244. 426. type printing
  15245. Submitter: Andy Koenig (europa!ark)
  15246. Date: 10/4/91
  15247. Version: 0.73
  15248. Severity: minor
  15249. Problem: 
  15250.   Spurious parenthesis around unit.
  15251. Transcript: 
  15252.     - (3,());
  15253.     val it = (3,()) : int * (unit)
  15254. Status: fixed in 0.74
  15255. ---------------------------------------------------------------------------
  15256. 427. Compiler bug: defineEqTycon/eqtyc
  15257. Submitter: John Reppy
  15258. Date: 10/6/91
  15259. Version: 0.73
  15260. Severity: ?
  15261. Problem: 
  15262.   Compiler bug: defineEqTycon/eqtyc -- bad tycon
  15263. Transcript: 
  15264.   Standard ML of New Jersey, Version 0.73, 10 September 1991
  15265.   Arrays have changed; see doc/NEWS
  15266.   val it = () : unit
  15267.   -     datatype 'a array = ARRAY of 'a ref VECTOR;
  15268.   std_in:2.38-2.43 Error: unbound type constructor VECTOR
  15269.   Error: Compiler bug: defineEqTycon/eqtyc -- bad tycon
  15270. Comments:
  15271.   Obviously this code is incorrect, but I have a bigger example that
  15272.   only prints out the "bad tycon" message.
  15273. Status: fixed in 0.74
  15274. ---------------------------------------------------------------------------
  15275. 428. openStructureVar -- bad access value
  15276. Submitter:      Benjamin.Pierce@cs.cmu.edu
  15277. Date:        4/3/91
  15278. Version:        0.67 (with SourceGroup)
  15279. System:         SunOS 4.1
  15280. Severity:       Major
  15281. Problem:        Compiler bug: EnvAccess.openStructureVar -- bad access value
  15282. Code:           see below
  15283. Transcript:     
  15284.  
  15285. Standard ML of New Jersey, Version 0.67, 21 November 1990
  15286. (Built on Sun Mar 17 11:37:30 EST 1991 with GnuTags and SourceGroup)
  15287. val it = () : unit
  15288. - use "bad.tmp";
  15289. [opening bad.tmp]
  15290. signature WR =
  15291.   sig
  15292.     type Wr
  15293.     val close : Wr -> unit
  15294.     val extract_str : Wr -> string
  15295.     val to_file : string -> Wr
  15296.     val to_fn : (string -> unit) -> (unit -> unit) -> Wr
  15297.     val to_nowhere : unit -> Wr
  15298.     val to_stdout : unit -> Wr
  15299.     val to_string : unit -> Wr
  15300.     val to_wrs : Wr list -> Wr
  15301.     val write_wr : Wr -> string -> unit
  15302.   end
  15303. signature PP =
  15304.   sig
  15305.     structure Wr : sig...end
  15306.     type Pp
  15307.     val DEBUG : bool ref
  15308.     val break : Pp -> bool -> int -> unit
  15309.     val endb : Pp -> unit
  15310.     val expbreak : Pp -> bool -> string -> unit
  15311.     val pp_from_wr : Wr.Wr -> Pp
  15312.     val pwrite : Pp -> string -> unit
  15313.     val set_margin : Pp -> int -> unit
  15314.     val setb : Pp -> unit
  15315.     val wr_from_pp : Pp -> Wr.Wr
  15316.   end
  15317. signature WRMGT =
  15318.   sig
  15319.     structure Pp : sig...end
  15320.     structure Wr : sig...end
  15321.     val get_current_wr : unit -> Wr.Wr
  15322.     val set_current_wr : Wr.Wr -> unit
  15323.     val stdpp : unit -> Pp.Pp
  15324.     val write : string -> unit
  15325.   end
  15326. signature STRINGUTILS =
  15327.   sig
  15328.   end
  15329. signature REGISTRY =
  15330.   sig
  15331.     type registeredtype
  15332.     val register : string -> (registeredtype -> unit) -> unit
  15333.     val registerflag : string -> registeredtype ref -> unit
  15334.     val set_all : registeredtype -> unit
  15335.     val set_flag : string -> registeredtype -> unit
  15336.   end
  15337. signature LISTUTILS =
  15338.   sig
  15339.     val filter : ('a -> bool) -> 'a list -> 'a list
  15340.     val forall : ('a -> bool) -> 'a list -> bool
  15341.     val forsome : ('a -> bool) -> 'a list -> bool
  15342.     val mapappend : ('a -> 'b list) -> 'a list -> 'b list
  15343.     val mapfold : ('a -> 'b) -> ('b -> 'b -> 'b) -> 'b -> 'a list -> 'b
  15344.     val mapunit : ('b -> 'a) -> 'b list -> unit
  15345.     val mapunit_tuple : ('a -> unit) -> (unit -> unit) -> 'a list -> unit
  15346.     val memq : ('a -> 'a -> bool) -> 'a list -> 'a -> bool
  15347.   end
  15348. signature ID =
  15349.   sig
  15350.     type T
  15351.     val == : T -> T -> bool
  15352.     val hashcode : T -> int
  15353.     val intern : string -> T
  15354.     val new : unit -> T
  15355.     val new_from : T -> T
  15356.     val tostr : T -> string
  15357.   end
  15358. signature DEBUGUTILS =
  15359.   sig
  15360.     val wrap : bool ref -> string -> (unit -> 'a) -> (unit -> unit) -> ('a -> unit) -> 'a
  15361.   end
  15362. signature GLOBALS =
  15363.   sig
  15364.     structure Id : sig...end
  15365.     structure Pp : sig...end
  15366.     structure Pp : sig...end
  15367.     structure Wr : sig...end
  15368.     structure Wr : sig...end
  15369.     structure WrMgt : sig...end
  15370.     type registeredtype
  15371.     val filter : ('a -> bool) -> 'a list -> 'a list
  15372.     val forall : ('a -> bool) -> 'a list -> bool
  15373.     val forsome : ('a -> bool) -> 'a list -> bool
  15374.     val get_current_wr : unit -> Wr.Wr
  15375.     val mapappend : ('a -> 'b list) -> 'a list -> 'b list
  15376.     val mapfold : ('a -> 'b) -> ('b -> 'b -> 'b) -> 'b -> 'a list -> 'b
  15377.     val mapunit : ('b -> 'a) -> 'b list -> unit
  15378.     val mapunit_tuple : ('a -> unit) -> (unit -> unit) -> 'a list -> unit
  15379.     val memq : ('a -> 'a -> bool) -> 'a list -> 'a -> bool
  15380.     val register : string -> (registeredtype -> unit) -> unit
  15381.     val registerflag : string -> registeredtype ref -> unit
  15382.     val set_all : registeredtype -> unit
  15383.     val set_current_wr : Wr.Wr -> unit
  15384.     val set_flag : string -> registeredtype -> unit
  15385.     val stdpp : unit -> Pp.Pp
  15386.     val wrap : bool ref -> string -> (unit -> 'a) -> (unit -> unit) -> ('a -> unit) -> 'a
  15387.     val write : string -> unit
  15388.   end
  15389. Error: Compiler bug: EnvAccess.openStructureVar -- bad access value
  15390. [closing bad.tmp]
  15391.  
  15392.  
  15393. --------------------------------------------------------------------------
  15394. (* And here's the offending file ... *)
  15395.  
  15396. signature WR = sig
  15397.  
  15398. type Wr
  15399.  
  15400. val to_stdout: unit -> Wr
  15401. val to_file: string -> Wr
  15402. val to_nowhere: unit -> Wr
  15403. val to_wrs: Wr list -> Wr
  15404. val to_fn: (string->unit) -> (unit->unit) -> Wr
  15405. val to_string: unit -> Wr
  15406. val extract_str: Wr -> string
  15407.  
  15408. val close: Wr -> unit
  15409.  
  15410. val write_wr: Wr -> string -> unit
  15411.  
  15412. end;
  15413. signature PP = sig
  15414.  
  15415. structure Wr: WR
  15416.  
  15417. type Pp
  15418.  
  15419. val pp_from_wr: Wr.Wr -> Pp
  15420. val wr_from_pp: Pp -> Wr.Wr;
  15421.  
  15422. val pwrite : Pp -> string -> unit
  15423. val setb: Pp -> unit
  15424. val endb: Pp -> unit
  15425. val break: Pp -> bool -> int -> unit
  15426. val expbreak: Pp -> bool -> string -> unit
  15427. val set_margin: Pp -> int -> unit
  15428.  
  15429. val DEBUG: bool ref
  15430.  
  15431. end;
  15432.  
  15433. signature WRMGT = sig
  15434.  
  15435. (* Maintains a notion of a current (prettyprinting) writer 
  15436.    and its associated prettyprinter *)
  15437.  
  15438. structure Wr: WR;
  15439. structure Pp: PP;
  15440. sharing Pp.Wr = Wr;
  15441.  
  15442. val set_current_wr: Wr.Wr -> unit;
  15443. val get_current_wr: unit -> Wr.Wr;
  15444. val stdpp: unit -> Pp.Pp;
  15445.  
  15446. val write: string -> unit;
  15447.  
  15448. end;
  15449.  
  15450. signature STRINGUTILS = sig
  15451.  
  15452. end;
  15453.  
  15454. signature REGISTRY = sig
  15455.  
  15456. type registeredtype
  15457.  
  15458. val register: string -> (registeredtype->unit) -> unit
  15459. val registerflag: string -> (registeredtype ref) -> unit
  15460.  
  15461. val set_flag: string -> registeredtype -> unit
  15462. val set_all: registeredtype -> unit
  15463.  
  15464. end;
  15465.  
  15466. signature LISTUTILS = sig
  15467.  
  15468. val memq: ('a -> 'a -> bool) -> 'a list -> 'a -> bool
  15469.  
  15470. val mapappend: ('a -> 'b list) -> ('a list) -> ('b list)
  15471. val mapunit: ('a -> 'b) -> ('a list) -> unit
  15472. val mapunit_tuple: ('a -> unit) -> (unit -> unit) -> ('a list) -> unit
  15473.  
  15474. val mapfold: ('a -> 'b) -> ('b -> 'b -> 'b) -> 'b -> ('a list) -> 'b
  15475. val forall: ('a -> bool) -> ('a list) -> bool
  15476. val forsome: ('a -> bool) -> ('a list) -> bool
  15477.  
  15478. val filter: ('a -> bool) -> ('a list) -> ('a list)
  15479.  
  15480. end;
  15481.  
  15482. signature ID = sig
  15483.  
  15484. type T 
  15485.  
  15486. val intern: string -> T
  15487. val tostr: T -> string
  15488.  
  15489. val hashcode: T -> int 
  15490. val new: unit -> T
  15491. val new_from: T -> T
  15492.  
  15493. val == : T -> T -> bool
  15494.  
  15495. end;
  15496.  
  15497.  
  15498. (* May eventually want to support these too:
  15499.  
  15500.    val lexlt : T -> T -> bool
  15501. *)
  15502.  
  15503. signature DEBUGUTILS = sig
  15504.  
  15505. val wrap: (bool ref) -> string -> (unit -> 'a) -> (unit -> unit) -> ('a -> unit) -> 'a
  15506.  
  15507. end;
  15508.  
  15509. signature GLOBALS = sig
  15510.  
  15511. structure Wr: WR
  15512. structure Pp: PP
  15513. structure WrMgt: WRMGT
  15514. structure Id: ID
  15515.  
  15516. sharing Pp.Wr = Wr
  15517. sharing WrMgt.Pp = Pp
  15518.  
  15519. include WRMGT
  15520.  
  15521. include LISTUTILS
  15522. include STRINGUTILS
  15523. include DEBUGUTILS
  15524. include REGISTRY
  15525.  
  15526. sharing type registeredtype = bool
  15527.  
  15528. end;
  15529.  
  15530. signature TYPPVT = sig
  15531.  
  15532. structure Globals: GLOBALS
  15533. open Globals
  15534.  
  15535. datatype pretyp = 
  15536.         PRETVAR of Id.T
  15537.       | PREARROW of pretyp * pretyp
  15538.       | PREALL of Id.T * pretyp * pretyp
  15539.       | PREMEET of pretyp list
  15540.  
  15541. datatype T = 
  15542.         TVAR of unit * int
  15543.       | ARROW of unit * T * T
  15544.       | ALL of {name:Id.T} * T * T
  15545.       | MEET of unit * (T list)
  15546.       
  15547. datatype tenvelt = BND of Id.T * T
  15548.          | ABB of Id.T * T
  15549.          | VBND of Id.T * T
  15550.  
  15551. datatype tenv = TENV of tenvelt list
  15552.  
  15553. val empty_tenv: tenv
  15554. val extend_bound: tenv -> Id.T -> T -> tenv
  15555. val push_bound: tenv -> Id.T -> T -> tenv
  15556. val extend_abbrev: tenv -> Id.T -> T -> tenv
  15557. val push_abbrev: tenv -> Id.T -> T -> tenv
  15558. val extend_binding: tenv -> Id.T -> T -> tenv
  15559. val push_binding: tenv -> Id.T -> T -> tenv
  15560. val pop: tenv -> tenv
  15561.  
  15562. val index: tenv -> Id.T -> int
  15563. val lookup_name: tenv -> int -> Id.T
  15564. val lookup_and_relocate_bound: tenv -> int -> T
  15565. val lookup_and_relocate_binding: tenv -> int -> T
  15566. val lookup_and_relocate: tenv -> int -> tenvelt
  15567. val lookup: tenv -> int -> tenvelt
  15568. val relocate: int -> T -> T
  15569.  
  15570. exception UnknownId of string
  15571. exception WrongKindOfId of tenv * int * string
  15572. val debruijnify: tenv -> pretyp -> T
  15573.  
  15574. val prt: Pp.Pp -> tenv -> T -> unit
  15575. val prt_tenv: Pp.Pp -> tenv -> unit
  15576.  
  15577. val NS: T
  15578.  
  15579. end;
  15580. Status: fixed in 0.71
  15581. ---------------------------------------------------------------------------
  15582. 429. signature match fails
  15583. Submitter: Benjamin Pierce <Benjamin.Pierce@PROOF.ERGO.CS.CMU.EDU>
  15584. Date: 4/4/91
  15585. Version: 0.69
  15586. Problem: signature spec not matched when it should be
  15587. Transcript:
  15588.   Standard ML of New Jersey, Version 0.69, 3 April 1991
  15589.   val it = () : unit
  15590.   - use "bug.tmp";
  15591.   use "bug.tmp";
  15592.   [opening bug.tmp]
  15593.  
  15594.   [Major collection...
  15595.   [Increasing heap to 10011k]
  15596.    96% used (3502604/3627780), 7260 msec]
  15597.  
  15598.   [Increasing heap to 10431k]
  15599.   bug.tmp:1545.8-1775.3 Error: value type in structure doesn't match signature spec
  15600.     name: prt
  15601.     spec:   Pp -> tenv -> T -> unit
  15602.     actual: ?.Pp -> tenv -> T -> unit
  15603.   bug.tmp:1545.8-1775.3 Error: value type in structure doesn't match signature spec
  15604.     name: prt_tenv
  15605.     spec:   Pp -> tenv -> unit
  15606.     actual: ?.Pp -> tenv -> unit
  15607.   bug.tmp:1798.7-1802.44 Error: operator and operand don't agree (tycon mismatch)
  15608.     operator domain: ?.Pp
  15609.     operand:         ?.Pp
  15610.     in expression:
  15611.       Typ.prt pp
  15612.   bug.tmp:1798.7-1820.56 Error: rules don't agree (tycon mismatch)
  15613.     expected: ?.Pp * 'Z * 'Y list * 'X * rhs_flag -> unit
  15614.     found:    ?.Pp * tenv * lhsqueue list * 'W * 'V -> 'U
  15615.     rule:
  15616.       (pp,te,:: (ARROW_LHS <pat>,nil),t2,flag) => (<exp> <exp> te t1;# # t2 flag)
  15617.   bug.tmp:1807.7-1809.38 Error: operator and operand don't agree (tycon mismatch)
  15618.     operator domain: ?.Pp
  15619.     operand:         ?.Pp
  15620.     in expression:
  15621.       Pp.pwrite pp
  15622.   bug.tmp:1798.7-1820.56 Error: rules don't agree (tycon mismatch)
  15623.     expected: ?.Pp * 'Z * 'Y list * 'X * rhs_flag -> unit
  15624.     found:    ?.Pp * tenv * lhsqueue list * 'W * 'V -> 'U
  15625.     rule:
  15626.       (pp,te,:: (ARROW_LHS <pat>,X2),t2,flag) => (<exp> <exp> te t1;Pp.pwrite pp ",";# # t2 flag)
  15627.   bug.tmp:1811.7-1814.56 Error: operator and operand don't agree (tycon mismatch)
  15628.     operator domain: ?.Pp
  15629.     operand:         ?.Pp
  15630.     in expression:
  15631.       Typ.prt pp
  15632.   bug.tmp:1811.7-1814.56 Error: operator and operand don't agree (tycon mismatch)
  15633.     operator domain: ?.Pp
  15634.     operand:         ?.Pp
  15635.     in expression:
  15636.       describe_rest pp
  15637.   bug.tmp:1816.7-1820.56 Error: operator and operand don't agree (tycon mismatch)
  15638.     operator domain: ?.Pp
  15639.     operand:         ?.Pp
  15640.     in expression:
  15641.       Typ.prt pp
  15642.   bug.tmp:1816.7-1820.56 Error: operator and operand don't agree (tycon mismatch)
  15643.     operator domain: ?.Pp
  15644.     operand:         ?.Pp
  15645.     in expression:
  15646.       describe_rest pp
  15647.   bug.tmp:1797.1-1820.56 Error: pattern and expression in val rec dec don't agree (tycon mismatch)
  15648.     pattern:    ?.Pp -> tenv -> lhsqueue list -> 'Z -> 'Y -> 'X
  15649.     expression: ?.Pp -> tenv -> lhsqueue list -> 'W -> rhs_flag -> unit
  15650.     in declaration:
  15651.       describe_rest = (fn arg => (fn <pat> => <exp>))
  15652.   bug.tmp:1823.3-1829.14 Error: operator and operand don't agree (tycon mismatch)
  15653.     operator domain: ?.Pp
  15654.     operand:         ?.Pp
  15655.     in expression:
  15656.       Typ.prt pp
  15657.   bug.tmp:1823.3-1829.14 Error: operator and operand don't agree (tycon mismatch)
  15658.     operator domain: ?.Pp
  15659.     operand:         ?.Pp
  15660.     in expression:
  15661.       describe_rest pp
  15662.   bug.tmp:1874.15-1874.54 Error: operator and operand don't agree (tycon mismatch)
  15663.     operator domain: ?.Pp
  15664.     operand:         ?.Pp
  15665.     in expression:
  15666.       describe_problem (stdpp ())
  15667.   [closing bug.tmp]
  15668.  
  15669.  
  15670.   --------------------------------------------------------------------------
  15671.   (* and here's the offending file...  Sorry it's a bit long *)
  15672.  
  15673.   signature WR = sig
  15674.  
  15675.   type Wr
  15676.  
  15677.   val to_stdout: unit -> Wr
  15678.   val to_file: string -> Wr
  15679.   val to_nowhere: unit -> Wr
  15680.   val to_wrs: Wr list -> Wr
  15681.   val to_fn: (string->unit) -> (unit->unit) -> Wr
  15682.   val to_string: unit -> Wr
  15683.   val extract_str: Wr -> string
  15684.  
  15685.   val close: Wr -> unit
  15686.  
  15687.   val write_wr: Wr -> string -> unit
  15688.  
  15689.   end
  15690.   signature PP = sig
  15691.  
  15692.   structure Wr: WR
  15693.  
  15694.   type Pp
  15695.  
  15696.   val pp_from_wr: Wr.Wr -> Pp
  15697.   val wr_from_pp: Pp -> Wr.Wr;
  15698.  
  15699.   val pwrite : Pp -> string -> unit
  15700.   val setb: Pp -> unit
  15701.   val endb: Pp -> unit
  15702.   val break: Pp -> bool -> int -> unit
  15703.   val expbreak: Pp -> bool -> string -> unit
  15704.   val set_margin: Pp -> int -> unit
  15705.  
  15706.   val DEBUG: bool ref
  15707.  
  15708.   end
  15709.   signature WRMGT = sig
  15710.  
  15711.   (* Maintains a notion of a current (prettyprinting) writer 
  15712.      and its associated prettyprinter *)
  15713.  
  15714.   structure Wr: WR;
  15715.   structure Pp: PP;
  15716.   sharing Pp.Wr = Wr;
  15717.  
  15718.   val set_current_wr: Wr.Wr -> unit;
  15719.   val get_current_wr: unit -> Wr.Wr;
  15720.   val stdpp: unit -> Pp.Pp;
  15721.  
  15722.   val write: string -> unit;
  15723.  
  15724.   end
  15725.   signature STRINGUTILS = sig
  15726.  
  15727.   end
  15728.   signature REGISTRY = sig
  15729.  
  15730.   type registeredtype
  15731.  
  15732.   val register: string -> (registeredtype->unit) -> unit
  15733.   val registerflag: string -> (registeredtype ref) -> unit
  15734.  
  15735.   val set_flag: string -> registeredtype -> unit
  15736.   val set_all: registeredtype -> unit
  15737.  
  15738.   end
  15739.   signature LISTUTILS = sig
  15740.  
  15741.   val memq: ('a -> 'a -> bool) -> 'a list -> 'a -> bool
  15742.  
  15743.   val mapappend: ('a -> 'b list) -> ('a list) -> ('b list)
  15744.   val mapunit: ('a -> 'b) -> ('a list) -> unit
  15745.   val mapunit_tuple: ('a -> unit) -> (unit -> unit) -> ('a list) -> unit
  15746.  
  15747.   val mapfold: ('a -> 'b) -> ('b -> 'b -> 'b) -> 'b -> ('a list) -> 'b
  15748.   val forall: ('a -> bool) -> ('a list) -> bool
  15749.   val forsome: ('a -> bool) -> ('a list) -> bool
  15750.  
  15751.   val filter: ('a -> bool) -> ('a list) -> ('a list)
  15752.  
  15753.   end
  15754.   signature ID = sig
  15755.  
  15756.   type T 
  15757.  
  15758.   val intern: string -> T
  15759.   val tostr: T -> string
  15760.  
  15761.   val hashcode: T -> int 
  15762.   val new: unit -> T
  15763.   val new_from: T -> T
  15764.  
  15765.   val == : T -> T -> bool
  15766.  
  15767.   end
  15768.  
  15769.   (* May eventually want to support these too:
  15770.  
  15771.      val lexlt : T -> T -> bool
  15772.   *)
  15773.  
  15774.   signature DEBUGUTILS = sig
  15775.  
  15776.   val wrap: (bool ref) -> string -> (unit -> 'a) -> (unit -> unit) -> ('a -> unit) -> 'a
  15777.  
  15778.   end
  15779.   signature GLOBALS = sig
  15780.  
  15781.   structure Wr: WR
  15782.   structure Pp: PP
  15783.   structure WrMgt: WRMGT
  15784.   structure Id: ID
  15785.  
  15786.   sharing Pp.Wr = Wr
  15787.   sharing WrMgt.Pp = Pp
  15788.  
  15789.   include WRMGT
  15790.  
  15791.   include LISTUTILS
  15792.   include STRINGUTILS
  15793.   include DEBUGUTILS
  15794.   include REGISTRY
  15795.  
  15796.   sharing type registeredtype = bool
  15797.  
  15798.   exception CantHappen
  15799.  
  15800.   end
  15801.   signature TYPPVT = sig
  15802.  
  15803.   structure Globals: GLOBALS
  15804.   open Globals
  15805.  
  15806.   datatype pretyp = 
  15807.           PRETVAR of Id.T
  15808.         | PREARROW of pretyp * pretyp
  15809.         | PREALL of Id.T * pretyp * pretyp
  15810.         | PREMEET of pretyp list
  15811.  
  15812.   datatype T = 
  15813.           TVAR of unit * int
  15814.         | ARROW of unit * T * T
  15815.         | ALL of {name:Id.T} * T * T
  15816.         | MEET of unit * (T list)
  15817.  
  15818.   datatype tenvelt = BND of Id.T * T
  15819.            | ABB of Id.T * T
  15820.            | VBND of Id.T * T
  15821.  
  15822.   datatype tenv = TENV of tenvelt list
  15823.  
  15824.   val empty_tenv: tenv
  15825.   val push_bound: tenv -> Id.T -> T -> tenv
  15826.   val push_abbrev: tenv -> Id.T -> T -> tenv
  15827.   val push_binding: tenv -> Id.T -> T -> tenv
  15828.   val pop: tenv -> tenv
  15829.  
  15830.   val index: tenv -> Id.T -> int
  15831.   val lookup_name: tenv -> int -> Id.T
  15832.   val lookup_and_relocate_bound: tenv -> int -> T
  15833.   val lookup_and_relocate_binding: tenv -> int -> T
  15834.   val lookup_and_relocate: tenv -> int -> tenvelt
  15835.   val lookup: tenv -> int -> tenvelt
  15836.   val relocate: int -> T -> T
  15837.  
  15838.   (* Substitute the first arg for instances of var #0 in the second arg *)
  15839.   val tsubst_top: T -> T -> T
  15840.  
  15841.   exception UnknownId of string
  15842.   exception WrongKindOfId of tenv * int * string
  15843.   val debruijnify: tenv -> pretyp -> T
  15844.  
  15845.   val prt: Pp.Pp -> tenv -> T -> unit
  15846.   val prt_tenv: Pp.Pp -> tenv -> unit
  15847.  
  15848.   val NS: T
  15849.  
  15850.   end
  15851.  
  15852.   signature LEQ = sig
  15853.  
  15854.   structure Typ: TYPPVT
  15855.   structure Globals: GLOBALS
  15856.   sharing Globals = Typ.Globals
  15857.  
  15858.   val leq: Typ.tenv -> Typ.T -> Typ.T -> bool
  15859.  
  15860.   end
  15861.   (* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
  15862.  
  15863.   (* LR_TABLE: signature for an LR Table.
  15864.  
  15865.      The list of actions and gotos passed to mkLrTable must be ordered by state
  15866.      number. The values for state 0 are the first in the list, the values for
  15867.       state 1 are next, etc.
  15868.   *)
  15869.  
  15870.   signature LR_TABLE =
  15871.       sig
  15872.       datatype state = STATE of int
  15873.       datatype term = T of int
  15874.       datatype nonterm = NT of int
  15875.       datatype action = SHIFT of state
  15876.               | REDUCE of int
  15877.               | ACCEPT
  15878.               | ERROR
  15879.       type table
  15880.  
  15881.       val numStates : table -> int
  15882.       val describeActions : table -> state ->
  15883.                   ((term * action) list) * action
  15884.       val describeGoto : table -> state -> (nonterm * state) list
  15885.       val action : table -> state * term -> action
  15886.       val goto : table -> state * nonterm -> state
  15887.       val initialState : table -> state
  15888.       exception Goto of state * nonterm
  15889.  
  15890.       val mkLrTable : {actions : (((term * action) list) * action) list,
  15891.                gotos : (nonterm * state) list list,
  15892.                numStates : int,
  15893.                initialState : state} -> table
  15894.       end
  15895.  
  15896.   (* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
  15897.  
  15898.   (* import "lr_table.sig"; *)
  15899.  
  15900.   (* TOKEN: signature revealing the internal structure of a token. This signature
  15901.      TOKEN distinct from the signature {parser name}_TOKENS produced by ML-Yacc.
  15902.      The {parser name}_TOKENS structures contain some types and functions to
  15903.       construct tokens from values and positions.
  15904.  
  15905.      The representation of token was very carefully chosen here to allow the
  15906.      polymorphic parser to work without knowing the types of semantic values
  15907.      or line numbers.
  15908.  
  15909.      This has had an impact on the TOKENS structure produced by SML-Yacc, which
  15910.      is a structure parameter to lexer functors.  We would like to have some
  15911.      type 'a token which functions to construct tokens would create.  A
  15912.      constructor function for a integer token might be
  15913.  
  15914.         INT: int * 'a * 'a -> 'a token.
  15915.  
  15916.      This is not possible because we need to have tokens with the representation
  15917.      given below for the polymorphic parser.
  15918.  
  15919.      Thus our constructur functions for tokens have the form:
  15920.  
  15921.         INT: int * 'a * 'a -> (svalue,'a) token
  15922.  
  15923.      This in turn has had an impact on the signature that lexers for SML-Yacc
  15924.      must match and the types that a user must declare in the user declarations
  15925.      section of lexers.
  15926.   *)
  15927.  
  15928.   signature TOKEN =
  15929.       sig
  15930.       structure LrTable : LR_TABLE
  15931.       datatype ('a,'b) token = TOKEN of LrTable.term * ('a * 'b * 'b)
  15932.       val sameToken : ('a,'b) token * ('a,'b) token -> bool
  15933.       end
  15934.  
  15935.   (* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
  15936.  
  15937.   (*
  15938.   import "lr_table.sig";
  15939.   import "token.sig";
  15940.   *)
  15941.  
  15942.   (* PARSER_DATA: the signature of ParserData structures in {parser name}LrValsFun
  15943.      produced by  SML-Yacc.  All such structures match this signature.  
  15944.  
  15945.      The {parser name}LrValsFun produces a structure which contains all the values
  15946.      except for the lexer needed to call the polymorphic parser mentioned
  15947.      before.
  15948.  
  15949.   *)
  15950.  
  15951.   signature PARSER_DATA =
  15952.      sig
  15953.       (* the type of line numbers *)
  15954.  
  15955.       type pos
  15956.  
  15957.       (* the type of semantic values *)
  15958.  
  15959.       type svalue
  15960.  
  15961.        (* the type of the user-supplied argument to the parser *)
  15962.       type arg
  15963.  
  15964.       (* the intended type of the result of the parser.  This value is
  15965.          produced by applying extract from the structure Actions to the
  15966.          final semantic value resultiing from a parse.
  15967.        *)
  15968.  
  15969.       type result
  15970.  
  15971.       structure LrTable : LR_TABLE
  15972.       structure Token : TOKEN
  15973.       sharing Token.LrTable = LrTable
  15974.  
  15975.       (* structure Actions contains the functions which mantain the
  15976.          semantic values stack in the parser.  Void is used to provide
  15977.          a default value for the semantic stack.
  15978.        *)
  15979.  
  15980.       structure Actions : 
  15981.         sig
  15982.         val actions : int * pos *
  15983.              (LrTable.state * (svalue * pos * pos)) list * arg->
  15984.                LrTable.nonterm * (svalue * pos * pos) *
  15985.                ((LrTable.state *(svalue * pos * pos)) list)
  15986.         val void : svalue
  15987.         val extract : svalue -> result
  15988.         end
  15989.  
  15990.       (* structure EC contains information used to improve error
  15991.          recovery in an error-correcting parser *)
  15992.  
  15993.       structure EC :
  15994.          sig
  15995.        val is_keyword : LrTable.term -> bool
  15996.            val noShift : LrTable.term -> bool
  15997.            val preferred_subst : LrTable.term -> LrTable.term list
  15998.            val preferred_insert : LrTable.term -> bool
  15999.            val errtermvalue : LrTable.term -> svalue
  16000.            val showTerminal : LrTable.term -> string
  16001.            val terms: LrTable.term list
  16002.          end
  16003.  
  16004.       (* table is the LR table for the parser *)
  16005.  
  16006.       val table : LrTable.table
  16007.       end
  16008.  
  16009.   signature FMEET_TOKENS =
  16010.   sig
  16011.   type ('a,'b) token
  16012.   type svalue
  16013.   val T_PACK: ('a * 'a) ->(svalue,'a) token
  16014.   val T_END: ('a * 'a) ->(svalue,'a) token
  16015.   val T_OPEN: ('a * 'a) ->(svalue,'a) token
  16016.   val T_SOME: ('a * 'a) ->(svalue,'a) token
  16017.   val T_INSTALL: ('a * 'a) ->(svalue,'a) token
  16018.   val T_OBSERVE: ('a * 'a) ->(svalue,'a) token
  16019.   val T_FOR: ('a * 'a) ->(svalue,'a) token
  16020.   val T_OF: ('a * 'a) ->(svalue,'a) token
  16021.   val T_CASE: ('a * 'a) ->(svalue,'a) token
  16022.   val T_NS: ('a * 'a) ->(svalue,'a) token
  16023.   val T_IN: ('a * 'a) ->(svalue,'a) token
  16024.   val T_ALL: ('a * 'a) ->(svalue,'a) token
  16025.   val T_WITH: ('a * 'a) ->(svalue,'a) token
  16026.   val T_CHECK: ('a * 'a) ->(svalue,'a) token
  16027.   val T_DEBUG: ('a * 'a) ->(svalue,'a) token
  16028.   val T_RESET: ('a * 'a) ->(svalue,'a) token
  16029.   val T_SET: ('a * 'a) ->(svalue,'a) token
  16030.   val T_TYPE: ('a * 'a) ->(svalue,'a) token
  16031.   val T_USE: ('a * 'a) ->(svalue,'a) token
  16032.   val T_STR_CONST: ((string) * 'a * 'a) ->(svalue,'a) token
  16033.   val T_INT_CONST: ((string) * 'a * 'a) ->(svalue,'a) token
  16034.   val T_ID: ((string) * 'a * 'a) ->(svalue,'a) token
  16035.   val T_BIGLAMBDA: ('a * 'a) ->(svalue,'a) token
  16036.   val T_LAMBDA: ('a * 'a) ->(svalue,'a) token
  16037.   val T_INTER: ('a * 'a) ->(svalue,'a) token
  16038.   val T_RCURLY: ('a * 'a) ->(svalue,'a) token
  16039.   val T_LCURLY: ('a * 'a) ->(svalue,'a) token
  16040.   val T_RANGLE: ('a * 'a) ->(svalue,'a) token
  16041.   val T_LANGLE: ('a * 'a) ->(svalue,'a) token
  16042.   val T_RBRACK: ('a * 'a) ->(svalue,'a) token
  16043.   val T_LBRACK: ('a * 'a) ->(svalue,'a) token
  16044.   val T_RPAREN: ('a * 'a) ->(svalue,'a) token
  16045.   val T_LPAREN: ('a * 'a) ->(svalue,'a) token
  16046.   val T_DARROW: ('a * 'a) ->(svalue,'a) token
  16047.   val T_ARROW: ('a * 'a) ->(svalue,'a) token
  16048.   val T_AT: ('a * 'a) ->(svalue,'a) token
  16049.   val T_DOLLAR: ('a * 'a) ->(svalue,'a) token
  16050.   val T_DOUBLEEQ: ('a * 'a) ->(svalue,'a) token
  16051.   val T_EQ: ('a * 'a) ->(svalue,'a) token
  16052.   val T_APOST: ('a * 'a) ->(svalue,'a) token
  16053.   val T_COMMA: ('a * 'a) ->(svalue,'a) token
  16054.   val T_LEQ: ('a * 'a) ->(svalue,'a) token
  16055.   val T_SEMICOLON: ('a * 'a) ->(svalue,'a) token
  16056.   val T_COLON: ('a * 'a) ->(svalue,'a) token
  16057.   val T_DOT: ('a * 'a) ->(svalue,'a) token
  16058.   val T_EOF: ('a * 'a) ->(svalue,'a) token
  16059.   end
  16060.   signature FMEET_LRVALS =
  16061.   sig
  16062.   structure Tokens : FMEET_TOKENS
  16063.   structure ParserData:PARSER_DATA
  16064.   sharing type ParserData.Token.token = Tokens.token
  16065.   sharing type ParserData.svalue = Tokens.svalue
  16066.   end
  16067.   (* Externally visible aspects of the lexer and parser *)
  16068.  
  16069.   signature INTERFACE =
  16070.   sig
  16071.  
  16072.   type pos
  16073.   val line : pos ref
  16074.   val init_line : unit -> unit
  16075.   val next_line : unit -> unit
  16076.   val error : string * pos * pos -> unit
  16077.  
  16078.   end  (* signature INTERFACE *)
  16079.  
  16080.   signature TYP = sig
  16081.  
  16082.   structure Globals: GLOBALS
  16083.   open Globals
  16084.  
  16085.   datatype pretyp = 
  16086.           PRETVAR of Id.T
  16087.         | PREARROW of pretyp * pretyp
  16088.         | PREALL of Id.T * pretyp * pretyp
  16089.         | PREMEET of pretyp list
  16090.  
  16091.   type T
  16092.  
  16093.   type tenv
  16094.   val empty_tenv: tenv
  16095.   val push_bound: tenv -> Id.T -> T -> tenv
  16096.   val push_abbrev: tenv -> Id.T -> T -> tenv
  16097.   val push_binding: tenv -> Id.T -> T -> tenv
  16098.   val pop: tenv -> tenv
  16099.  
  16100.   exception UnknownId of string
  16101.   exception WrongKindOfId of tenv * int * string
  16102.   val debruijnify: tenv -> pretyp -> T
  16103.  
  16104.   val prt: Pp.Pp -> tenv -> T -> unit
  16105.   val prt_tenv: Pp.Pp -> tenv -> unit
  16106.  
  16107.   val NS: T
  16108.  
  16109.   end
  16110.  
  16111.   signature TRM = sig
  16112.  
  16113.   structure Globals: GLOBALS
  16114.   structure Typ: TYP
  16115.   sharing Typ.Globals = Globals
  16116.   open Globals
  16117.  
  16118.   datatype pretrm = 
  16119.           PREVAR of Id.T
  16120.         | PREABS of Id.T * Typ.pretyp * pretrm
  16121.         | PREAPP of pretrm * pretrm
  16122.         | PRETABS of Id.T * Typ.pretyp * pretrm
  16123.         | PRETAPP of pretrm * Typ.pretyp
  16124.         | PREFOR of Id.T * (Typ.pretyp list) * pretrm
  16125.  
  16126.   type T
  16127.  
  16128.   exception UnknownId of string
  16129.   val debruijnify: Typ.tenv -> pretrm -> T
  16130.  
  16131.   val prt: Pp.Pp -> Typ.tenv -> T -> unit
  16132.  
  16133.   end
  16134.  
  16135.   signature PARSERES = sig
  16136.  
  16137.   structure Typ : TYP
  16138.   structure Trm : TRM
  16139.   structure Globals: GLOBALS
  16140.   sharing Typ.Globals = Globals
  16141.   sharing Trm.Typ = Typ
  16142.  
  16143.   datatype T =
  16144.       Leq of Typ.pretyp * Typ.pretyp
  16145.     | Type_Assumption of Globals.Id.T * Typ.pretyp
  16146.     | Type_Abbrev of Globals.Id.T * Typ.pretyp
  16147.     | Term_Def of Globals.Id.T * Trm.pretrm
  16148.     | Term_Assumption of Globals.Id.T * Typ.pretyp
  16149.     | Use of string
  16150.     | Set of string * string
  16151.     | Nothing
  16152.  
  16153.   end 
  16154.   signature PARSE =
  16155.   sig
  16156.  
  16157.   structure ParseRes : PARSERES
  16158.  
  16159.   val file_parse: string -> ParseRes.T;
  16160.   val stream_parse: instream -> ParseRes.T;
  16161.   val top_parse: unit -> ParseRes.T;
  16162.  
  16163.   end  (* signature PARSE *)
  16164.  
  16165.   (* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
  16166.  
  16167.   (* STREAM: signature for a lazy stream.*)
  16168.  
  16169.   signature STREAM =
  16170.    sig type 'xa stream
  16171.        val streamify : (unit -> '_a) -> '_a stream
  16172.        val cons : '_a * '_a stream -> '_a stream
  16173.        val get : '_a stream -> '_a * '_a stream
  16174.    end
  16175.  
  16176.   (* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
  16177.  
  16178.   (*
  16179.   import "token.sig";
  16180.   import "stream.sig";
  16181.   *)
  16182.  
  16183.   (* signature PARSER is the signature that most user parsers created by 
  16184.      SML-Yacc will match.
  16185.   *)
  16186.  
  16187.   signature PARSER =
  16188.       sig
  16189.       structure Token : TOKEN
  16190.       structure Stream : STREAM
  16191.       exception ParseError
  16192.  
  16193.       (* type pos is the type of line numbers *)
  16194.  
  16195.       type pos
  16196.  
  16197.       (* type result is the type of the result from the parser *)
  16198.  
  16199.       type result
  16200.  
  16201.        (* the type of the user-supplied argument to the parser *)
  16202.       type arg
  16203.  
  16204.       (* type svalue is the type of semantic values for the semantic value
  16205.          stack
  16206.        *)
  16207.  
  16208.       type svalue
  16209.  
  16210.       (* val makeLexer is used to create a stream of tokens for the parser *)
  16211.  
  16212.       val makeLexer : (int -> string) ->
  16213.                (svalue,pos) Token.token Stream.stream
  16214.  
  16215.       (* val parse takes a stream of tokens and a function to prt
  16216.          errors and returns a value of type result and a stream containing
  16217.          the unused tokens
  16218.        *)
  16219.  
  16220.       val parse : int * ((svalue,pos) Token.token Stream.stream) *
  16221.               (string * pos * pos -> unit) * arg ->
  16222.                   result * (svalue,pos) Token.token Stream.stream
  16223.  
  16224.       val sameToken : (svalue,pos) Token.token * (svalue,pos) Token.token ->
  16225.                   bool
  16226.        end
  16227.  
  16228.   functor Parse (structure Globals : GLOBALS
  16229.          structure ParseRes : PARSERES
  16230.          structure Interface : INTERFACE
  16231.          structure Parser : PARSER
  16232.             sharing type Parser.pos = Interface.pos
  16233.             sharing type Parser.result = ParseRes.T
  16234.             sharing type Parser.arg = unit
  16235.          structure Tokens : FMEET_TOKENS
  16236.             sharing type Tokens.token = Parser.Token.token
  16237.             sharing type Tokens.svalue = Parser.svalue
  16238.          ) : PARSE =
  16239.   struct
  16240.  
  16241.   structure ParseRes = ParseRes
  16242.   open Globals
  16243.  
  16244.   val parse = fn (lookahead,reader : int -> string) =>
  16245.       let val _ = Interface.init_line()
  16246.       val empty = !Interface.line
  16247.       val dummyEOF = Tokens.T_EOF(empty,empty)
  16248.       fun invoke lexer = 
  16249.          Parser.parse(lookahead,lexer,Interface.error,())
  16250.       fun loop lexer =
  16251.         let val (result,lexer) = invoke lexer
  16252.         val (nextToken,lexer) = Parser.Stream.get lexer
  16253.         in if Parser.sameToken(nextToken,dummyEOF) then result
  16254.            else loop lexer
  16255.         end
  16256.        in loop (Parser.makeLexer reader)
  16257.        end
  16258.  
  16259.   fun string_reader s =
  16260.    let val next = ref s
  16261.    in fn _ => !next before next := ""
  16262.    end
  16263.  
  16264.   val string_parse = fn s => parse (0, string_reader s)
  16265.  
  16266.   val file_parse = fn name =>
  16267.     let val dev = open_in name
  16268.      in (parse (15,(fn i => input(dev,i)))) before close_in dev
  16269.      end
  16270.  
  16271.   fun prefix line len = substring(line,0,min(len,size line))    
  16272.  
  16273.   fun echo_line line =
  16274.       if (line = "\n") orelse (line="")
  16275.      then write line
  16276.       else if prefix line 3 = "%% "
  16277.      then write (substring(line,3,size(line)-3))
  16278.       else if prefix line 2 = "%%"
  16279.      then write (substring(line,2,size(line)-2))
  16280.       else write ("> " ^ line)
  16281.  
  16282.   fun convert_tabs s =
  16283.       implode (map (fn "\t" => "        " | s => s) (explode s));
  16284.  
  16285.   fun stream_parse dev =
  16286.      parse (15,(fn i => 
  16287.            let val line = convert_tabs(input_line(dev))
  16288.                val _ = echo_line line
  16289.            in line
  16290.            end))
  16291.  
  16292.   val top_parse = fn () => parse (0,
  16293.           let val not_first_flag = ref(false)
  16294.           in fn i => (( if (!not_first_flag)
  16295.                    then (write "> "; flush_out std_out)
  16296.                    else not_first_flag := true );
  16297.                   input_line std_in)
  16298.           end)
  16299.  
  16300.   end  (* functor Parse *)
  16301.  
  16302.   signature SYNTH = sig
  16303.  
  16304.   structure Globals: GLOBALS
  16305.   structure Trm: TRM
  16306.   structure Typ: TYP
  16307.   structure Leq: LEQ
  16308.   sharing Trm.Typ = Typ
  16309.       and Leq.Typ = Typ
  16310.       and Typ.Globals = Globals
  16311.   open Globals
  16312.  
  16313.   val synth: Typ.tenv -> Trm.T -> Typ.T
  16314.  
  16315.   end
  16316.   (* Copyright 1989 by AT&T Bell Laboratories *)
  16317.   (* util/strghash.sml *)
  16318.  
  16319.   (* Functorized by BCP, 1991 *)
  16320.  
  16321.   functor StrgHash() =
  16322.   struct
  16323.  
  16324.     val prime = 8388593 (* largest prime less than 2^23 *)
  16325.     val base = 128
  16326.  
  16327.   (* the simple version --
  16328.       fun hashString(str: string) : int =
  16329.       let fun loop (0,n) = n
  16330.         | loop (i,n) = 
  16331.             let val i = i-1
  16332.             val n' = (base * n + ordof(str,i)) 
  16333.              in loop (i, (n' - prime * (n' quot prime)))
  16334.             end
  16335.        in loop (size str,0)
  16336.       end
  16337.   *)
  16338.  
  16339.     fun hashString(str: string) : int =
  16340.     let val l = size str
  16341.      in case l
  16342.           of 0 => 0
  16343.            | 1 => ord str
  16344.            | 2 => ordof(str,0) + base * ordof(str,1)
  16345.            | 3 => ordof(str,0) + base * (ordof(str,1) + base * ordof(str,2))
  16346.            | _ =>
  16347.           let fun loop (0,n) = n
  16348.             | loop (i,n) = 
  16349.                 let val i = i-1
  16350.                 val n' = (base * n + ordof(str,i)) 
  16351.                  in loop (i, (n' - prime * (n' quot prime)))
  16352.                 end
  16353.            in loop (l,0)
  16354.           end
  16355.     end
  16356.  
  16357.   end (* structure StrgHash *)
  16358.   functor StringUtils() : STRINGUTILS = struct
  16359.  
  16360.   end
  16361.   (* ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
  16362.  
  16363.   (* LEXER: a signature that most lexers produced for use with SML-Yacc's
  16364.      outut will match.  The user is responsible for declaring type token,
  16365.      type pos, and type svalue in the UserDeclarations section of a lexer.
  16366.  
  16367.      Note that type token is abstract in the lexer.  This allows SML-Yacc to
  16368.      create a TOKENS signature for use with lexers produced by ML-Lex that
  16369.      treats the type token abstractly.  Lexers that are functors parametrized by
  16370.      a Tokens structure matching a TOKENS signature cannot examine the structure
  16371.      of tokens.
  16372.   *)
  16373.  
  16374.   signature LEXER =
  16375.      sig
  16376.      structure UserDeclarations :
  16377.          sig
  16378.           type ('a,'b) token
  16379.           type pos
  16380.           type svalue
  16381.          end
  16382.       val makeLexer : (int -> string) -> unit -> 
  16383.        (UserDeclarations.svalue,UserDeclarations.pos) UserDeclarations.token
  16384.      end
  16385.  
  16386.   functor FMEETLexFun(structure Tokens: FMEET_TOKENS structure Interface: INTERFACE) : LEXER=
  16387.      struct
  16388.       structure UserDeclarations =
  16389.     struct
  16390.   structure Tokens = Tokens
  16391.   structure Interface = Interface
  16392.   open Interface
  16393.  
  16394.   type pos = Interface.pos
  16395.   type svalue = Tokens.svalue
  16396.   type ('a,'b) token = ('a,'b) Tokens.token
  16397.   type lexresult= (svalue,pos) token
  16398.  
  16399.   val eof = fn () => Tokens.T_EOF(!line,!line)
  16400.  
  16401.   val str_begin = ref(!line);
  16402.   val str_const = ref([]:string list);
  16403.  
  16404.   end (* end of user routines *)
  16405.   exception LexError (* raised if illegal leaf action tried *)
  16406.   structure Internal =
  16407.       struct
  16408.  
  16409.   datatype yyfinstate = N of int
  16410.   type statedata = {fin : yyfinstate list, trans: string}
  16411.   (* transition & final state table *)
  16412.   val tab = let
  16413.   val s0 =
  16414.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16415.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16416.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16417.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16418.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16419.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16420.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16421.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16422.   \\000"
  16423.   val s1 =
  16424.   "\007\007\007\007\007\007\007\007\007\097\099\007\007\007\007\007\
  16425.   \\007\007\007\007\007\007\007\007\007\007\007\007\007\007\007\007\
  16426.   \\097\007\007\007\096\095\007\094\093\092\007\007\091\089\088\086\
  16427.   \\084\084\084\084\084\084\084\084\084\084\083\082\080\077\076\007\
  16428.   \\075\072\010\010\010\010\010\010\010\010\010\010\010\010\070\010\
  16429.   \\010\010\010\066\010\010\010\010\010\010\010\065\063\062\007\007\
  16430.   \\061\010\010\053\048\045\042\010\010\040\010\010\010\010\010\035\
  16431.   \\031\010\026\023\019\016\010\012\010\010\010\009\007\008\007\007\
  16432.   \\007"
  16433.   val s3 =
  16434.   "\100\100\100\100\100\100\100\100\100\100\101\100\100\100\100\100\
  16435.   \\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\
  16436.   \\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\
  16437.   \\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\
  16438.   \\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\
  16439.   \\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\
  16440.   \\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\
  16441.   \\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\100\
  16442.   \\100"
  16443.   val s5 =
  16444.   "\102\102\102\102\102\102\102\102\102\102\104\102\102\102\102\102\
  16445.   \\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\
  16446.   \\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\
  16447.   \\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\
  16448.   \\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\
  16449.   \\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\
  16450.   \\103\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\
  16451.   \\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\102\
  16452.   \\102"
  16453.   val s10 =
  16454.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16455.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16456.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16457.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16458.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16459.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16460.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16461.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16462.   \\000"
  16463.   val s12 =
  16464.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16465.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16466.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16467.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16468.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16469.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16470.   \\000\011\011\011\011\011\011\011\011\013\011\011\011\011\011\011\
  16471.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16472.   \\000"
  16473.   val s13 =
  16474.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16475.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16476.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16477.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16478.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16479.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16480.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16481.   \\011\011\011\011\014\011\011\011\011\011\011\000\000\000\000\000\
  16482.   \\000"
  16483.   val s14 =
  16484.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16485.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16486.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16487.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16488.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16489.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16490.   \\000\011\011\011\011\011\011\011\015\011\011\011\011\011\011\011\
  16491.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16492.   \\000"
  16493.   val s16 =
  16494.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16495.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16496.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16497.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16498.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16499.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16500.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16501.   \\011\011\011\017\011\011\011\011\011\011\011\000\000\000\000\000\
  16502.   \\000"
  16503.   val s17 =
  16504.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16505.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16506.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16507.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16508.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16509.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16510.   \\000\011\011\011\011\018\011\011\011\011\011\011\011\011\011\011\
  16511.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16512.   \\000"
  16513.   val s19 =
  16514.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16515.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16516.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16517.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16518.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16519.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16520.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16521.   \\011\011\011\011\011\011\011\011\011\020\011\000\000\000\000\000\
  16522.   \\000"
  16523.   val s20 =
  16524.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16525.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16526.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16527.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16528.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16529.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16530.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16531.   \\021\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16532.   \\000"
  16533.   val s21 =
  16534.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16535.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16536.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16537.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16538.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16539.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16540.   \\000\011\011\011\011\022\011\011\011\011\011\011\011\011\011\011\
  16541.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16542.   \\000"
  16543.   val s23 =
  16544.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16545.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16546.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16547.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16548.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16549.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16550.   \\000\011\011\011\011\024\011\011\011\011\011\011\011\011\011\011\
  16551.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16552.   \\000"
  16553.   val s24 =
  16554.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16555.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16556.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16557.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16558.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16559.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16560.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16561.   \\011\011\011\011\025\011\011\011\011\011\011\000\000\000\000\000\
  16562.   \\000"
  16563.   val s26 =
  16564.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16565.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16566.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16567.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16568.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16569.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16570.   \\000\011\011\011\011\027\011\011\011\011\011\011\011\011\011\011\
  16571.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16572.   \\000"
  16573.   val s27 =
  16574.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16575.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16576.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16577.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16578.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16579.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16580.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16581.   \\011\011\011\028\011\011\011\011\011\011\011\000\000\000\000\000\
  16582.   \\000"
  16583.   val s28 =
  16584.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16585.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16586.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16587.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16588.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16589.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16590.   \\000\011\011\011\011\029\011\011\011\011\011\011\011\011\011\011\
  16591.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16592.   \\000"
  16593.   val s29 =
  16594.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16595.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16596.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16597.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16598.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16599.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16600.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16601.   \\011\011\011\011\030\011\011\011\011\011\011\000\000\000\000\000\
  16602.   \\000"
  16603.   val s31 =
  16604.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16605.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16606.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16607.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16608.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16609.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16610.   \\000\032\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16611.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16612.   \\000"
  16613.   val s32 =
  16614.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16615.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16616.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16617.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16618.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16619.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16620.   \\000\011\011\033\011\011\011\011\011\011\011\011\011\011\011\011\
  16621.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16622.   \\000"
  16623.   val s33 =
  16624.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16625.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16626.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16627.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16628.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16629.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16630.   \\000\011\011\011\011\011\011\011\011\011\011\034\011\011\011\011\
  16631.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16632.   \\000"
  16633.   val s35 =
  16634.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16635.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16636.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16637.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16638.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16639.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16640.   \\000\011\011\011\011\011\039\011\011\011\011\011\011\011\011\011\
  16641.   \\036\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16642.   \\000"
  16643.   val s36 =
  16644.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16645.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16646.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16647.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16648.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16649.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16650.   \\000\011\011\011\011\037\011\011\011\011\011\011\011\011\011\011\
  16651.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16652.   \\000"
  16653.   val s37 =
  16654.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16655.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16656.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16657.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16658.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16659.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16660.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\038\011\
  16661.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16662.   \\000"
  16663.   val s40 =
  16664.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16665.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16666.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16667.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16668.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16669.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16670.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\041\011\
  16671.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16672.   \\000"
  16673.   val s42 =
  16674.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16675.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16676.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16677.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16678.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16679.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16680.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\043\
  16681.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16682.   \\000"
  16683.   val s43 =
  16684.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16685.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16686.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16687.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16688.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16689.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16690.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16691.   \\011\011\044\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16692.   \\000"
  16693.   val s45 =
  16694.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16695.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16696.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16697.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16698.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16699.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16700.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\046\011\
  16701.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16702.   \\000"
  16703.   val s46 =
  16704.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16705.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16706.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16707.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16708.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16709.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16710.   \\000\011\011\011\047\011\011\011\011\011\011\011\011\011\011\011\
  16711.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16712.   \\000"
  16713.   val s48 =
  16714.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16715.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16716.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16717.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16718.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16719.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16720.   \\000\011\011\011\011\049\011\011\011\011\011\011\011\011\011\011\
  16721.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16722.   \\000"
  16723.   val s49 =
  16724.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16725.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16726.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16727.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16728.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16729.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16730.   \\000\011\050\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16731.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16732.   \\000"
  16733.   val s50 =
  16734.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16735.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16736.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16737.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16738.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16739.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16740.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16741.   \\011\011\011\011\011\051\011\011\011\011\011\000\000\000\000\000\
  16742.   \\000"
  16743.   val s51 =
  16744.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16745.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16746.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16747.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16748.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16749.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16750.   \\000\011\011\011\011\011\011\052\011\011\011\011\011\011\011\011\
  16751.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16752.   \\000"
  16753.   val s53 =
  16754.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16755.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16756.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16757.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16758.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16759.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16760.   \\000\058\011\011\011\011\011\011\054\011\011\011\011\011\011\011\
  16761.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16762.   \\000"
  16763.   val s54 =
  16764.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16765.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16766.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16767.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16768.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16769.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16770.   \\000\011\011\011\011\055\011\011\011\011\011\011\011\011\011\011\
  16771.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16772.   \\000"
  16773.   val s55 =
  16774.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16775.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16776.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16777.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16778.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16779.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16780.   \\000\011\011\056\011\011\011\011\011\011\011\011\011\011\011\011\
  16781.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16782.   \\000"
  16783.   val s56 =
  16784.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16785.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16786.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16787.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16788.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16789.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16790.   \\000\011\011\011\011\011\011\011\011\011\011\057\011\011\011\011\
  16791.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16792.   \\000"
  16793.   val s58 =
  16794.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16795.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16796.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16797.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16798.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16799.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16800.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16801.   \\011\011\011\059\011\011\011\011\011\011\011\000\000\000\000\000\
  16802.   \\000"
  16803.   val s59 =
  16804.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16805.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16806.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16807.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16808.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16809.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16810.   \\000\011\011\011\011\060\011\011\011\011\011\011\011\011\011\011\
  16811.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16812.   \\000"
  16813.   val s63 =
  16814.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16815.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16816.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16817.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16818.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16819.   \\000\000\000\000\000\000\000\000\000\000\000\000\064\000\000\000\
  16820.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16821.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16822.   \\000"
  16823.   val s66 =
  16824.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16825.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16826.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16827.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16828.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16829.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16830.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\067\
  16831.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16832.   \\000"
  16833.   val s67 =
  16834.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16835.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16836.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16837.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16838.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16839.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16840.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\068\011\011\
  16841.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16842.   \\000"
  16843.   val s68 =
  16844.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16845.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16846.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16847.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16848.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16849.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16850.   \\000\011\011\011\011\069\011\011\011\011\011\011\011\011\011\011\
  16851.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16852.   \\000"
  16853.   val s70 =
  16854.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16855.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16856.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16857.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16858.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16859.   \\011\011\011\071\011\011\011\011\011\011\011\000\000\000\000\011\
  16860.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16861.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16862.   \\000"
  16863.   val s72 =
  16864.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16865.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16866.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16867.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16868.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16869.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16870.   \\000\011\011\011\011\011\011\011\011\011\011\011\073\011\011\011\
  16871.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16872.   \\000"
  16873.   val s73 =
  16874.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16875.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16876.   \\000\000\000\000\000\000\000\011\000\000\000\000\000\000\000\000\
  16877.   \\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\000\
  16878.   \\000\011\011\011\011\011\011\011\011\011\011\011\011\011\011\011\
  16879.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\011\
  16880.   \\000\011\011\011\011\011\011\011\011\011\011\011\074\011\011\011\
  16881.   \\011\011\011\011\011\011\011\011\011\011\011\000\000\000\000\000\
  16882.   \\000"
  16883.   val s77 =
  16884.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16885.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16886.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16887.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\079\078\000\
  16888.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16889.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16890.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16891.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16892.   \\000"
  16893.   val s80 =
  16894.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16895.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16896.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16897.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\081\000\000\
  16898.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16899.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16900.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16901.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16902.   \\000"
  16903.   val s84 =
  16904.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16905.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16906.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16907.   \\085\085\085\085\085\085\085\085\085\085\000\000\000\000\000\000\
  16908.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16909.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16910.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16911.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16912.   \\000"
  16913.   val s86 =
  16914.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16915.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16916.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16917.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16918.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16919.   \\000\000\000\000\000\000\000\000\000\000\000\000\087\000\000\000\
  16920.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16921.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16922.   \\000"
  16923.   val s89 =
  16924.   "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16925.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16926.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16927.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\090\000\
  16928.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16929.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16930.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16931.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16932.   \\000"
  16933.   val s97 =
  16934.   "\000\000\000\000\000\000\000\000\000\098\000\000\000\000\000\000\
  16935.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16936.   \\098\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16937.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16938.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16939.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16940.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16941.   \\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\
  16942.   \\000"
  16943.   in arrayoflist
  16944.   [{fin = [], trans = s0},
  16945.   {fin = [(N 32)], trans = s1},
  16946.   {fin = [(N 32)], trans = s1},
  16947.   {fin = [], trans = s3},
  16948.   {fin = [], trans = s3},
  16949.   {fin = [], trans = s5},
  16950.   {fin = [], trans = s5},
  16951.   {fin = [(N 144)], trans = s0},
  16952.   {fin = [(N 80),(N 144)], trans = s0},
  16953.   {fin = [(N 78),(N 144)], trans = s0},
  16954.   {fin = [(N 137),(N 144)], trans = s10},
  16955.   {fin = [(N 137)], trans = s10},
  16956.   {fin = [(N 137),(N 144)], trans = s12},
  16957.   {fin = [(N 137)], trans = s13},
  16958.   {fin = [(N 137)], trans = s14},
  16959.   {fin = [(N 91),(N 137)], trans = s10},
  16960.   {fin = [(N 137),(N 144)], trans = s16},
  16961.   {fin = [(N 137)], trans = s17},
  16962.   {fin = [(N 3),(N 137)], trans = s10},
  16963.   {fin = [(N 137),(N 144)], trans = s19},
  16964.   {fin = [(N 137)], trans = s20},
  16965.   {fin = [(N 137)], trans = s21},
  16966.   {fin = [(N 8),(N 137)], trans = s10},
  16967.   {fin = [(N 137),(N 144)], trans = s23},
  16968.   {fin = [(N 137)], trans = s24},
  16969.   {fin = [(N 12),(N 137)], trans = s10},
  16970.   {fin = [(N 137),(N 144)], trans = s26},
  16971.   {fin = [(N 137)], trans = s27},
  16972.   {fin = [(N 137)], trans = s28},
  16973.   {fin = [(N 137)], trans = s29},
  16974.   {fin = [(N 18),(N 137)], trans = s10},
  16975.   {fin = [(N 137),(N 144)], trans = s31},
  16976.   {fin = [(N 137)], trans = s32},
  16977.   {fin = [(N 137)], trans = s33},
  16978.   {fin = [(N 122),(N 137)], trans = s10},
  16979.   {fin = [(N 137),(N 144)], trans = s35},
  16980.   {fin = [(N 137)], trans = s36},
  16981.   {fin = [(N 137)], trans = s37},
  16982.   {fin = [(N 117),(N 137)], trans = s10},
  16983.   {fin = [(N 99),(N 137)], trans = s10},
  16984.   {fin = [(N 137),(N 144)], trans = s40},
  16985.   {fin = [(N 129),(N 137)], trans = s10},
  16986.   {fin = [(N 137),(N 144)], trans = s42},
  16987.   {fin = [(N 137)], trans = s43},
  16988.   {fin = [(N 103),(N 137)], trans = s10},
  16989.   {fin = [(N 137),(N 144)], trans = s45},
  16990.   {fin = [(N 137)], trans = s46},
  16991.   {fin = [(N 126),(N 137)], trans = s10},
  16992.   {fin = [(N 137),(N 144)], trans = s48},
  16993.   {fin = [(N 137)], trans = s49},
  16994.   {fin = [(N 137)], trans = s50},
  16995.   {fin = [(N 137)], trans = s51},
  16996.   {fin = [(N 24),(N 137)], trans = s10},
  16997.   {fin = [(N 137),(N 144)], trans = s53},
  16998.   {fin = [(N 137)], trans = s54},
  16999.   {fin = [(N 137)], trans = s55},
  17000.   {fin = [(N 137)], trans = s56},
  17001.   {fin = [(N 30),(N 137)], trans = s10},
  17002.   {fin = [(N 137)], trans = s58},
  17003.   {fin = [(N 137)], trans = s59},
  17004.   {fin = [(N 96),(N 137)], trans = s10},
  17005.   {fin = [(N 142),(N 144)], trans = s0},
  17006.   {fin = [(N 72),(N 144)], trans = s0},
  17007.   {fin = [(N 134),(N 144)], trans = s63},
  17008.   {fin = [(N 132)], trans = s0},
  17009.   {fin = [(N 70),(N 144)], trans = s0},
  17010.   {fin = [(N 137),(N 144)], trans = s66},
  17011.   {fin = [(N 137)], trans = s67},
  17012.   {fin = [(N 137)], trans = s68},
  17013.   {fin = [(N 112),(N 137)], trans = s10},
  17014.   {fin = [(N 137),(N 144)], trans = s70},
  17015.   {fin = [(N 86),(N 137)], trans = s10},
  17016.   {fin = [(N 137),(N 144)], trans = s72},
  17017.   {fin = [(N 137)], trans = s73},
  17018.   {fin = [(N 107),(N 137)], trans = s10},
  17019.   {fin = [(N 42),(N 144)], trans = s0},
  17020.   {fin = [(N 76),(N 144)], trans = s0},
  17021.   {fin = [(N 52),(N 144)], trans = s77},
  17022.   {fin = [(N 61)], trans = s0},
  17023.   {fin = [(N 55)], trans = s0},
  17024.   {fin = [(N 74),(N 144)], trans = s80},
  17025.   {fin = [(N 58)], trans = s0},
  17026.   {fin = [(N 44),(N 144)], trans = s0},
  17027.   {fin = [(N 38),(N 144)], trans = s0},
  17028.   {fin = [(N 140),(N 144)], trans = s84},
  17029.   {fin = [(N 140)], trans = s84},
  17030.   {fin = [(N 144)], trans = s86},
  17031.   {fin = [(N 64)], trans = s0},
  17032.   {fin = [(N 46),(N 144)], trans = s0},
  17033.   {fin = [(N 144)], trans = s89},
  17034.   {fin = [(N 83)], trans = s0},
  17035.   {fin = [(N 48),(N 144)], trans = s0},
  17036.   {fin = [(N 68),(N 144)], trans = s0},
  17037.   {fin = [(N 66),(N 144)], trans = s0},
  17038.   {fin = [(N 50),(N 144)], trans = s0},
  17039.   {fin = [(N 36),(N 144)], trans = s0},
  17040.   {fin = [(N 40),(N 144)], trans = s0},
  17041.   {fin = [(N 32),(N 144)], trans = s97},
  17042.   {fin = [(N 32)], trans = s97},
  17043.   {fin = [(N 34)], trans = s0},
  17044.   {fin = [(N 148)], trans = s0},
  17045.   {fin = [(N 146)], trans = s0},
  17046.   {fin = [(N 154)], trans = s0},
  17047.   {fin = [(N 152),(N 154)], trans = s0},
  17048.   {fin = [(N 150)], trans = s0}]
  17049.   end
  17050.   structure StartStates =
  17051.       struct
  17052.       datatype yystartstate = STARTSTATE of int
  17053.  
  17054.   (* start state definitions *)
  17055.  
  17056.   val COMMENT = STARTSTATE 3;
  17057.   val INITIAL = STARTSTATE 1;
  17058.   val STRING = STARTSTATE 5;
  17059.  
  17060.   end
  17061.   type result = UserDeclarations.lexresult
  17062.       exception LexerError (* raised if illegal leaf action tried *)
  17063.   end
  17064.  
  17065.   fun makeLexer yyinput = 
  17066.   let 
  17067.       val yyb = ref "\n"         (* buffer *)
  17068.       val yybl = ref 1        (*buffer length *)
  17069.       val yybufpos = ref 1        (* location of next character to use *)
  17070.       val yygone = ref 1        (* position in file of beginning of buffer *)
  17071.       val yydone = ref false        (* eof found yet? *)
  17072.       val yybegin = ref 1        (*Current 'start state' for lexer *)
  17073.  
  17074.       val YYBEGIN = fn (Internal.StartStates.STARTSTATE x) =>
  17075.            yybegin := x
  17076.  
  17077.   fun lex () : Internal.result =
  17078.   let fun continue() = lex() in
  17079.     let fun scan (s,AcceptingLeaves : Internal.yyfinstate list list,l,i0) =
  17080.       let fun action (i,nil) = raise LexError
  17081.       | action (i,nil::l) = action (i-1,l)
  17082.       | action (i,(node::acts)::l) =
  17083.           case node of
  17084.               Internal.N yyk => 
  17085.               (let val yytext = substring(!yyb,i0,i-i0)
  17086.                    val yypos = i0+ !yygone
  17087.               open UserDeclarations Internal.StartStates
  17088.    in (yybufpos := i; case yyk of 
  17089.  
  17090.               (* Application actions *)
  17091.  
  17092.     103 => (Tokens.T_FOR(!line,!line))
  17093.   | 107 => (Tokens.T_ALL(!line,!line))
  17094.   | 112 => (Tokens.T_SOME(!line,!line))
  17095.   | 117 => (Tokens.T_OPEN(!line,!line))
  17096.   | 12 => (Tokens.T_SET(!line,!line))
  17097.   | 122 => (Tokens.T_PACK(!line,!line))
  17098.   | 126 => (Tokens.T_END (!line,!line))
  17099.   | 129 => (Tokens.T_IN(!line,!line))
  17100.   | 132 => (Tokens.T_BIGLAMBDA(!line,!line))
  17101.   | 134 => (Tokens.T_LAMBDA(!line,!line))
  17102.   | 137 => (Tokens.T_ID (yytext,!line,!line))
  17103.   | 140 => (Tokens.T_INT_CONST (yytext,!line,!line))
  17104.   | 142 => (str_begin:=(!line); str_const:=[]; YYBEGIN STRING; lex())
  17105.   | 144 => (error ("ignoring illegal character" ^ yytext,
  17106.                  !line,!line); lex())
  17107.   | 146 => (next_line(); YYBEGIN INITIAL; lex())
  17108.   | 148 => (lex())
  17109.   | 150 => (next_line(); lex())
  17110.   | 152 => (YYBEGIN INITIAL;
  17111.               Tokens.T_STR_CONST(implode(rev(!str_const)),
  17112.                      !str_begin,!line))
  17113.   | 154 => (str_const:=(yytext::(!str_const)); lex())
  17114.   | 18 => (Tokens.T_RESET(!line,!line))
  17115.   | 24 => (Tokens.T_DEBUG(!line,!line))
  17116.   | 3 => (Tokens.T_USE(!line,!line))
  17117.   | 30 => (Tokens.T_CHECK(!line,!line))
  17118.   | 32 => (lex())
  17119.   | 34 => (next_line(); lex())
  17120.   | 36 => (YYBEGIN COMMENT; lex())
  17121.   | 38 => (Tokens.T_COLON(!line,!line))
  17122.   | 40 => (Tokens.T_DOLLAR(!line,!line))
  17123.   | 42 => (Tokens.T_AT(!line,!line))
  17124.   | 44 => (Tokens.T_EOF(!line,!line))
  17125.   | 46 => (Tokens.T_DOT(!line,!line))
  17126.   | 48 => (Tokens.T_COMMA(!line,!line))
  17127.   | 50 => (Tokens.T_APOST(!line,!line))
  17128.   | 52 => (Tokens.T_EQ(!line,!line))
  17129.   | 55 => (Tokens.T_DOUBLEEQ(!line,!line))
  17130.   | 58 => (Tokens.T_LEQ(!line,!line))
  17131.   | 61 => (Tokens.T_DARROW(!line,!line))
  17132.   | 64 => (Tokens.T_INTER(!line,!line))
  17133.   | 66 => (Tokens.T_LPAREN(!line,!line))
  17134.   | 68 => (Tokens.T_RPAREN(!line,!line))
  17135.   | 70 => (Tokens.T_LBRACK(!line,!line))
  17136.   | 72 => (Tokens.T_RBRACK(!line,!line))
  17137.   | 74 => (Tokens.T_LANGLE(!line,!line))
  17138.   | 76 => (Tokens.T_RANGLE(!line,!line))
  17139.   | 78 => (Tokens.T_LCURLY(!line,!line))
  17140.   | 8 => (Tokens.T_TYPE(!line,!line))
  17141.   | 80 => (Tokens.T_RCURLY(!line,!line))
  17142.   | 83 => (Tokens.T_ARROW(!line,!line))
  17143.   | 86 => (Tokens.T_NS(!line,!line))
  17144.   | 91 => (Tokens.T_WITH(!line,!line))
  17145.   | 96 => (Tokens.T_CASE(!line,!line))
  17146.   | 99 => (Tokens.T_OF(!line,!line))
  17147.   | _ => raise Internal.LexerError
  17148.  
  17149.           ) end )
  17150.  
  17151.       val {fin,trans} = Internal.tab sub s
  17152.       val NewAcceptingLeaves = fin::AcceptingLeaves
  17153.       in if l = !yybl then
  17154.            if trans = #trans(Internal.tab sub 0)
  17155.          then action(l,NewAcceptingLeaves) else
  17156.           let val newchars= if !yydone then "" else yyinput 1024
  17157.           in if (size newchars)=0
  17158.             then (yydone := true;
  17159.               if (l=i0) then UserDeclarations.eof ()
  17160.                     else action(l,NewAcceptingLeaves))
  17161.             else (if i0=l then yyb := newchars
  17162.                else yyb := substring(!yyb,i0,l-i0)^newchars;
  17163.                yygone := !yygone+i0;
  17164.                yybl := size (!yyb);
  17165.                scan (s,AcceptingLeaves,l-i0,0))
  17166.           end
  17167.         else let val NewChar = ordof(!yyb,l)
  17168.           val NewState = if NewChar<128 then ordof(trans,NewChar) else ordof(trans,128)
  17169.           in if NewState=0 then action(l,NewAcceptingLeaves)
  17170.           else scan(NewState,NewAcceptingLeaves,l+1,i0)
  17171.       end
  17172.       end
  17173.   (*
  17174.       val start= if substring(!yyb,!yybufpos-1,1)="\n"
  17175.   then !yybegin+1 else !yybegin
  17176.   *)
  17177.       in scan(!yybegin (* start *),nil,!yybufpos,!yybufpos)
  17178.       end
  17179.   end
  17180.     in lex
  17181.     end
  17182.   end
  17183.   functor Registry(
  17184.           type registeredtype
  17185.           ): REGISTRY = struct
  17186.  
  17187.   type registeredtype = registeredtype
  17188.  
  17189.   val registry = ref(nil: (string * (registeredtype->unit)) list)
  17190.  
  17191.   fun register name callback = 
  17192.     registry := (name,callback)::(!registry)
  17193.  
  17194.   fun registerflag name flagref =
  17195.     registry := (name,(fn b => flagref := b))::(!registry)
  17196.  
  17197.   exception NotRegistered of string
  17198.  
  17199.   fun set_flag name v = 
  17200.     let fun f [] = raise NotRegistered(name)
  17201.       | f ((n,callback)::tl) = if name=n 
  17202.                      then (callback v)
  17203.                      else f tl
  17204.     in f (!registry)
  17205.     end
  17206.  
  17207.   fun set_all v =
  17208.     let fun f [] = ()
  17209.       | f ((n,callback)::tl) = (callback v; f tl)
  17210.     in f (!registry)
  17211.     end
  17212.  
  17213.   end
  17214.   functor Typ(
  17215.           structure Globals: GLOBALS
  17216.           ) : TYPPVT
  17217.           = struct
  17218.  
  17219.   structure Globals = Globals
  17220.   open Globals
  17221.   open Pp
  17222.  
  17223.   datatype pretyp = 
  17224.           PRETVAR of Id.T
  17225.         | PREARROW of pretyp * pretyp
  17226.         | PREALL of Id.T * pretyp * pretyp
  17227.         | PREMEET of pretyp list
  17228.  
  17229.   datatype T = 
  17230.           TVAR of unit * int
  17231.         | ARROW of unit * T * T
  17232.         | ALL of {name:Id.T} * T * T
  17233.         | MEET of unit * (T list)
  17234.  
  17235.   type idindex = int
  17236.  
  17237.   val NS = MEET ((),[])
  17238.  
  17239.   exception UnknownId of string
  17240.  
  17241.   datatype tenvelt = BND of Id.T * T
  17242.            | ABB of Id.T * T
  17243.            | VBND of Id.T * T
  17244.  
  17245.   datatype tenv = TENV of tenvelt list
  17246.  
  17247.   fun push_bound (TENV(te)) i t = TENV(BND(i,t)::te)
  17248.  
  17249.   fun push_abbrev (TENV(te)) i t = TENV(ABB(i,t)::te)
  17250.  
  17251.   fun push_binding (TENV(te)) i t = TENV(VBND(i,t)::te)
  17252.  
  17253.   val empty_tenv = TENV(nil)
  17254.  
  17255.   fun index (TENV(bvs)) i =
  17256.     let fun ind [] n =
  17257.           raise UnknownId(Id.tostr i)
  17258.       | ind (BND(i',_)::rest) n =
  17259.           if Id.== i i'
  17260.          then n
  17261.          else ind rest (n+1)
  17262.       | ind (VBND(i',_)::rest) n =
  17263.           if Id.== i i'
  17264.          then n
  17265.          else ind rest (n+1)
  17266.       | ind (ABB(i',_)::rest) n =
  17267.           if Id.== i i'
  17268.          then n
  17269.          else ind rest (n+1)
  17270.     in ind bvs 0
  17271.     end
  17272.  
  17273.   exception TypeVariableOutOfRange of int
  17274.  
  17275.   fun old_lookup_name (TENV(te)) i = 
  17276.     (case (nth (te,i)) of
  17277.       BND(name,_) => name
  17278.     | VBND(name,_) => name
  17279.     | ABB(name,_) => name)
  17280.     handle Nth => Id.intern(("<BAD INDEX: " ^ (makestring i) ^ ">"))
  17281.  
  17282.   fun lookup_name (TENV(te)) i = 
  17283.     let fun l [] _ _ = Id.intern(("<BAD INDEX: " ^ (makestring i) ^ ">"))
  17284.       | l (hd::tl) rest 0 = 
  17285.           let val name = case hd of BND(n,_) => n | VBND(n,_) => n | ABB(n,_) => n
  17286.           in if memq Id.== rest name 
  17287.            then Id.intern ((Id.tostr name) ^ "^" ^ (makestring i))
  17288.            else name
  17289.           end
  17290.       | l (hd::tl) rest j = 
  17291.           let val name = case hd of BND(n,_) => n | VBND(n,_) => n | ABB(n,_) => n
  17292.           in l tl (name::rest) (j-1)
  17293.           end
  17294.     in l te [] i
  17295.     end
  17296.  
  17297.   exception WrongKindOfId of tenv * int * string
  17298.  
  17299.   fun lookup (TENV(te)) i =
  17300.     nth (te,i)
  17301.     handle Nth => raise TypeVariableOutOfRange(i)
  17302.  
  17303.   exception TriedToPopEmptyTEnv
  17304.   fun pop (TENV(hd::tl)) = TENV(tl)
  17305.     | pop _ = raise TriedToPopEmptyTEnv
  17306.  
  17307.   fun inner_relocate offset cutoff t =
  17308.     let fun r c (TVAR((),i)) = if i>=c 
  17309.                   then TVAR((),i + offset)
  17310.                   else TVAR((),i)
  17311.       | r c (ARROW((),t1,t2)) = ARROW((), r c t1, r c t2)
  17312.       | r c (ALL({name=i},t1,t2)) = ALL({name=i}, r c t1, r (c+1) t2)
  17313.       | r c (MEET((),ts)) = MEET((), map (fn t => r c t) ts)
  17314.     in r cutoff t
  17315.     end
  17316.  
  17317.   fun relocate offset t = inner_relocate offset 0 t
  17318.  
  17319.   fun lookup_and_relocate (te) i =
  17320.     case lookup te i of
  17321.       BND(n,b) => BND(n, relocate (i+1) b)
  17322.     | VBND(n,b) => VBND(n, relocate (i+1) b)
  17323.     | ABB(n,b) => ABB(n, relocate (i+1) b)
  17324.  
  17325.   fun lookup_and_relocate_bound te i = 
  17326.     case lookup_and_relocate te i of
  17327.       BND(_,b) => b
  17328.     | VBND(n,_) => raise WrongKindOfId(te,i,"tvar")
  17329.     | ABB(n,_) => raise WrongKindOfId(te,i,"tvar")
  17330.  
  17331.   fun lookup_and_relocate_binding te i = 
  17332.     case lookup_and_relocate te i of
  17333.       BND(n,b) => raise WrongKindOfId(te,i,"var")
  17334.     | VBND(n,b) => b
  17335.     | ABB(n,b) => raise WrongKindOfId(te,i,"var")
  17336.  
  17337.   fun lookup_abbrev te i = 
  17338.     case lookup_and_relocate te i of
  17339.       BND(n,_) => raise WrongKindOfId(te,i,"tabbrev")
  17340.     | VBND(n,b) => raise WrongKindOfId(te,i,"tabbrev")
  17341.     | ABB(n,b) => b
  17342.  
  17343.   fun debruijnify te (PRETVAR i) =
  17344.     TVAR((), index te i)
  17345.     | debruijnify te (PREARROW (pt1,pt2)) =
  17346.     ARROW((), debruijnify te pt1, debruijnify te pt2)
  17347.     | debruijnify te (PREALL (i,pt1,pt2)) =
  17348.     ALL({name=i}, debruijnify te pt1, debruijnify (push_bound te i NS) pt2)
  17349.     | debruijnify te (PREMEET pts) =
  17350.     MEET((), map (fn pt => debruijnify te pt) pts)
  17351.  
  17352.   fun tsubst_top targ tbody =
  17353.     let fun s i (t as TVAR(x,i')) = if i = i' 
  17354.                       then relocate i targ
  17355.                     else if i < i'
  17356.                       then TVAR(x,i'-1)
  17357.                     else t
  17358.       | s i (ARROW(x,t1,t2)) = ARROW(x, s i t1, s i t2)
  17359.       | s i (ALL(x,t1,t2)) = ALL(x, s i t1, s (i+1) t2)
  17360.       | s i (MEET(x,ts)) = MEET(x, map (fn t => s i t) ts)
  17361.     in s 0 tbody 
  17362.     end
  17363.  
  17364.   fun prt pp te t =
  17365.     let fun p te (TVAR(_,i)) =
  17366.         Pp.pwrite pp (Id.tostr (lookup_name te i))
  17367.       | p te (ARROW(_,t1,t2)) =
  17368.         (Pp.pwrite pp "(";
  17369.          p te t1;
  17370.          Pp.pwrite pp "->";
  17371.          p te t2;
  17372.          Pp.pwrite pp ")")
  17373.       | p te (ALL({name=i},t1,t2)) =
  17374.         (Pp.pwrite pp "(All ";
  17375.          Pp.pwrite pp (Id.tostr i);
  17376.          Pp.pwrite pp "<=";
  17377.          p te t1;
  17378.          Pp.pwrite pp ". ";
  17379.          p (push_bound te i t1) t2;
  17380.          Pp.pwrite pp ")")
  17381.       | p te (MEET(_,[])) =
  17382.          Pp.pwrite pp "NS"
  17383.       | p te (MEET(_,ts)) =
  17384.         (Pp.pwrite pp "/\\[";
  17385.          plist te ts;
  17386.          Pp.pwrite pp "]")
  17387.     and plist te [] = 
  17388.           ()
  17389.       | plist te [t] = 
  17390.           p te t
  17391.       | plist te (hd::tl) = 
  17392.           (p te hd; pwrite pp ","; plist te tl)
  17393.     in p te t
  17394.     end
  17395.  
  17396.   val short_tenvs = ref(true);
  17397.   val _ = registerflag "shorttenvs" short_tenvs;
  17398.  
  17399.   fun prt_tenv pp (TENV(te')) =
  17400.     let fun p [] = ()
  17401.       | p [(BND(i,t))] = 
  17402.           (Pp.pwrite pp (Id.tostr i);
  17403.            Pp.pwrite pp "<=";
  17404.            prt pp (TENV([])) t)
  17405.       | p ((BND(i,t))::tl) = 
  17406.           (if (!short_tenvs)
  17407.          then pwrite pp "... "
  17408.          else p tl; 
  17409.            Pp.pwrite pp ", ";
  17410.            Pp.break pp false 0;
  17411.            Pp.pwrite pp (Id.tostr i);
  17412.            Pp.pwrite pp "<=";
  17413.            prt pp (TENV(tl)) t)
  17414.       | p [(VBND(i,t))] = 
  17415.           (Pp.pwrite pp (Id.tostr i);
  17416.            Pp.pwrite pp ":";
  17417.            prt pp (TENV([])) t)
  17418.       | p ((VBND(i,t))::tl) = 
  17419.           (if (!short_tenvs)
  17420.          then pwrite pp "... "
  17421.          else p tl; 
  17422.            Pp.pwrite pp ", ";
  17423.            Pp.break pp false 0;
  17424.            Pp.pwrite pp (Id.tostr i);
  17425.            Pp.pwrite pp ":";
  17426.            prt pp (TENV(tl)) t)
  17427.       | p [(ABB(i,t))] = 
  17428.           (Pp.pwrite pp (Id.tostr i);
  17429.            Pp.pwrite pp "=";
  17430.            prt pp (TENV([])) t)
  17431.       | p ((ABB(i,t))::tl) = 
  17432.           (if (!short_tenvs)
  17433.          then pwrite pp "... "
  17434.          else p tl; 
  17435.            Pp.pwrite pp ", ";
  17436.            Pp.break pp false 0;
  17437.            Pp.pwrite pp (Id.tostr i);
  17438.            Pp.pwrite pp "=";
  17439.            prt pp (TENV(tl)) t)
  17440.     in Pp.pwrite pp "{";
  17441.        Pp.setb pp;
  17442.        p te';
  17443.        Pp.endb pp;
  17444.        Pp.pwrite pp "}"
  17445.     end
  17446.  
  17447.   end
  17448.   functor Leq(
  17449.         structure Typ: TYPPVT
  17450.         structure Globals: GLOBALS
  17451.         sharing Typ.Globals = Globals
  17452.         ) : LEQ = struct
  17453.  
  17454.   structure Typ = Typ
  17455.   structure Globals = Globals
  17456.   open Globals
  17457.   open Typ
  17458.  
  17459.   datatype lhsqueue = 
  17460.           ARROW_LHS of Typ.T
  17461.         | ALL_LHS   of Id.T * Typ.T
  17462.  
  17463.   datatype rhs_flag = EXPAND | FIX
  17464.  
  17465.   val DEBUG = ref(false)
  17466.   val _ = (registerflag "leq" DEBUG;
  17467.        registerflag "Leq" DEBUG)
  17468.  
  17469.   fun describe_rest pp te [] t flag = 
  17470.     (Pp.pwrite pp "] -> ";
  17471.      Typ.prt pp te t;
  17472.      case flag of
  17473.        EXPAND => Pp.pwrite pp " (EXPAND)?  "
  17474.      | FIX    => Pp.pwrite pp " (FIX)?  ")
  17475.     | describe_rest pp te [ARROW_LHS(t1)] t2 flag = 
  17476.     (Typ.prt pp te t1;
  17477.      describe_rest pp te [] t2 flag)
  17478.     | describe_rest pp te ((ARROW_LHS(t1))::X2) t2 flag = 
  17479.     (Typ.prt pp te t1;
  17480.      Pp.pwrite pp ",";
  17481.      describe_rest pp te X2 t2 flag)
  17482.     | describe_rest pp te [ALL_LHS(v,t1)] t2 flag = 
  17483.     (Pp.pwrite pp (Id.tostr v);
  17484.      Pp.pwrite pp "<=";
  17485.      Typ.prt pp te t1;
  17486.      describe_rest pp (push_bound te v t1) [] t2 flag)
  17487.     | describe_rest pp te ((ALL_LHS(v,t1))::X2) t2 flag = 
  17488.     (Pp.pwrite pp (Id.tostr v);
  17489.      Pp.pwrite pp "<=";
  17490.      Typ.prt pp te t1;
  17491.      Pp.pwrite pp ",";
  17492.      describe_rest pp (push_bound te v t1) X2 t2 flag)
  17493.  
  17494.   fun describe_problem pp te s X t flag =
  17495.     (Pp.setb pp;
  17496.      Typ.prt pp te s;
  17497.      Pp.break pp true ~3;
  17498.      Pp.pwrite pp " <= ";
  17499.      Pp.pwrite pp "[";
  17500.      describe_rest pp te X t flag;
  17501.      Pp.endb pp)
  17502.  
  17503.   fun bindings_in [] = 0
  17504.     | bindings_in (ARROW_LHS(_)::tl) = bindings_in tl
  17505.     | bindings_in (ALL_LHS(_)::tl) = 1 + (bindings_in tl)
  17506.  
  17507.   fun leqq' te s X (MEET(_,ts)) EXPAND =
  17508.     forall (fn t => leqq te s X t EXPAND) ts
  17509.     | leqq' te s X (ARROW(_,t1,t2)) EXPAND =
  17510.     leqq te s (X@[ARROW_LHS(t1)]) t2 EXPAND
  17511.     | leqq' te s X (ALL({name=i},t1,t2)) EXPAND =
  17512.     leqq te s (X@[ALL_LHS(i,t1)]) t2 EXPAND
  17513.     | leqq' te s X (t as TVAR(_,vt)) EXPAND =
  17514.     let val bx = bindings_in X
  17515.     in if vt < bx
  17516.        then leqq te s X t FIX
  17517.        else case Typ.lookup te (vt - bx) of 
  17518.          BND(_,_)  => leqq te s X t FIX
  17519.            | VBND(n,_)  => raise Typ.WrongKindOfId(te, vt - bx,"tvar or tabbrev")
  17520.            | ABB(_,ab) => leqq te s X (Typ.relocate (vt + bx) ab) EXPAND
  17521.     end
  17522.     | leqq' te (MEET(_,ss)) X (t as (TVAR(_,vt))) FIX =
  17523.     forsome (fn s => leqq te s X t FIX) ss
  17524.     | leqq' te (ARROW(_,s1,s2)) (ARROW_LHS(t1)::X) (t as (TVAR(_,vt))) FIX =
  17525.     (leqq te t1 [] s1 EXPAND)
  17526.     andalso
  17527.     (leqq te s2 X t FIX)
  17528.     | leqq' te (ALL(_,s1,s2)) (ALL_LHS(i,t1)::X) (t as (TVAR(_,vt))) FIX =
  17529.     (leqq (push_bound te i t1) s2 X t FIX)
  17530.     andalso
  17531.     (leqq te t1 [] s1 EXPAND)
  17532.     | leqq' te (TVAR(_,vs)) X (t as (TVAR(_,vt))) FIX =
  17533.     (vs = vt andalso (null X))
  17534.     orelse
  17535.     (case lookup_and_relocate te vs of
  17536.        BND(_,bnd) => (leqq te bnd X t FIX)
  17537.      | VBND(n,ab)  => raise Typ.WrongKindOfId(te,vs,"tvar or tabbrev")
  17538.      | ABB(_,ab)  => (leqq te ab X t FIX))
  17539.     | leqq' te s X t flag =
  17540.     false
  17541.  
  17542.   and leqq te s X t flag =
  17543.     wrap DEBUG "leqq"
  17544.       (fn () => 
  17545.     leqq' te s X t flag)
  17546.       (fn () => describe_problem (stdpp()) te s X t flag)
  17547.       (fn b => write (if b then "Yes" else "No"))
  17548.  
  17549.   (* and leqq te s X t = leqq' te s X t *)
  17550.  
  17551.   fun leq te s t = leqq te s [] t EXPAND
  17552.  
  17553.   end
  17554.   (* Gene Rollins
  17555.      School of Computer Science
  17556.      Carnegie-Mellon University
  17557.      Pittsburgh, PA 15213
  17558.      rollins@cs.cmu.edu *)
  17559.  
  17560.   functor HashFun () = struct
  17561.  
  17562.   val version = 1.0
  17563.  
  17564.   type ('a,'b) table = ('a*'a->bool) * (('a*int*'b) list array) * int
  17565.  
  17566.   fun create (sample'key :'1a) (equality :'1a * '1a -> bool)
  17567.          table'size (sample'value :'1b) :('1a,'1b) table =
  17568.     let val mt = tl [(sample'key, 0, sample'value)]
  17569.     in (equality, array (table'size, mt), table'size)
  17570.     end
  17571.  
  17572.   val defaultSize = 97 (* a prime; or try primes 37, 997 *)
  17573.  
  17574.   fun defaultEqual ((x :string), (y :string)) :bool = (x = y)
  17575.  
  17576.   fun createDefault (sample'value :'1b) :(string,'1b) table =
  17577.     let val mt = tl [("", 0, sample'value)]
  17578.     in (defaultEqual, array (defaultSize, mt), defaultSize)
  17579.     end
  17580.  
  17581.   fun enter ((equal, table, table'size) :('a,'b) table) key hash value = 
  17582.     let val place = hash mod table'size
  17583.     val bucket = table sub place
  17584.     fun put'in [] = [(key,hash,value)]
  17585.       | put'in ((k,h,v)::tail) =
  17586.           if (h = hash) andalso equal (k, key)
  17587.         then (key,hash,value)::tail
  17588.         else (k,h,v)::(put'in tail)
  17589.     in
  17590.       update (table, place, put'in bucket)
  17591.     end
  17592.  
  17593.   fun remove ((equal, table, table'size) :('a,'b) table) key hash =
  17594.     let val place = hash mod table'size
  17595.     val bucket = table sub place
  17596.     fun take'out [] = []
  17597.       | take'out ((k,h,v)::tail) =
  17598.           if (h = hash) andalso equal (k, key)
  17599.         then tail
  17600.         else (k,h,v)::(take'out tail)
  17601.     in
  17602.       update (table, place, take'out bucket)
  17603.     end
  17604.  
  17605.   fun lookup ((equal, table, table'size) :('a,'b) table) key hash =
  17606.     let val place = hash mod table'size
  17607.     val bucket = table sub place
  17608.     fun get'out [] = NONE
  17609.       | get'out ((k,h,v)::tail) =
  17610.           if (h = hash) andalso equal (k, key)
  17611.         then SOME v
  17612.         else get'out tail
  17613.     in
  17614.       get'out bucket
  17615.     end
  17616.  
  17617.   fun print ((_, table, table'size) :('a,'b) table)
  17618.         (print'key :'a -> unit) (print'value :'b -> unit) =
  17619.     let fun pr'bucket [] = ()
  17620.       | pr'bucket ((key,hash,value)::rest) =
  17621.           (print'key key; String.print ": ";
  17622.            Integer.print hash; String.print ": ";
  17623.            print'value value; String.print "\n"; pr'bucket rest)
  17624.     fun pr i =
  17625.       if i >= table'size then ()
  17626.         else
  17627.           case (table sub i) of
  17628.          [] => (pr (i+1))
  17629.            | (b as (h::t)) =>
  17630.            (String.print "["; Integer.print i; String.print "]\n";
  17631.             pr'bucket b; pr (i+1))
  17632.     in pr 0 end
  17633.  
  17634.   fun scan ((_, table, table'size) :('a,'b) table) operation =
  17635.     let fun map'bucket [] = ()
  17636.       | map'bucket ((key,hash,value)::rest) =
  17637.           (operation key hash value; map'bucket rest)
  17638.     fun iter i =
  17639.       if i >= table'size then ()
  17640.         else (map'bucket (table sub i); iter (i+1))
  17641.     in iter 0 end
  17642.  
  17643.   fun fold ((_, table, table'size) :('a, 'b) table)
  17644.        (operation :'a -> int -> 'b -> 'g -> 'g) (init :'g) :'g =
  17645.     let fun fold'bucket [] acc = acc
  17646.       | fold'bucket ((key,hash,value)::rest) acc =
  17647.            fold'bucket rest (operation key hash value acc)
  17648.     fun iter i acc =
  17649.       if i >= table'size then acc
  17650.         else iter (i+1) (fold'bucket (table sub i) acc)
  17651.     in iter 0 init end
  17652.  
  17653.   fun scanUpdate ((_, table, table'size) :('a,'b) table) operation =
  17654.     let fun map'bucket [] = []
  17655.       | map'bucket ((key,hash,value)::rest) =
  17656.           ((key,hash,operation key hash value)::(map'bucket rest))
  17657.     fun iter i =
  17658.       if i >= table'size then ()
  17659.         else (update (table, i, map'bucket (table sub i)); iter (i+1))
  17660.     in iter 0 end
  17661.  
  17662.   fun eliminate ((_, table, table'size) :('a,'b) table) predicate =
  17663.     let fun map'bucket [] = []
  17664.       | map'bucket ((key,hash,value)::rest) =
  17665.           if predicate key hash value then map'bucket rest
  17666.         else (key,hash,value)::(map'bucket rest)
  17667.     fun iter i =
  17668.       if i >= table'size then ()
  17669.         else (update (table, i, map'bucket (table sub i)); iter (i+1))
  17670.     in iter 0 end
  17671.  
  17672.   fun bucketLengths ((_, table, table'size) :('a,'b) table) (maxlen :int)
  17673.       :int array =
  17674.     let val count :int array = array (maxlen+1, 0)
  17675.     fun inc'sub x = 
  17676.       let val y = min (x, maxlen) in
  17677.         update (count, y, (count sub y) + 1)
  17678.       end
  17679.     fun iter i =
  17680.       if i >= table'size then ()
  17681.         else (inc'sub (length (table sub i)); iter (i+1))
  17682.     in
  17683.       iter 0;
  17684.       count
  17685.     end
  17686.  
  17687.   end
  17688.   (* Cribbed from...
  17689.      ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
  17690.  
  17691.   signature ORDSET =
  17692.      sig
  17693.     type set
  17694.     type elem
  17695.     exception Select_arb
  17696.     val app : (elem -> 'b) -> set -> unit
  17697.         and card: set -> int
  17698.         and closure: set * (elem -> set) -> set
  17699.         and difference: set * set -> set
  17700.         and elem_eq: (elem * elem -> bool)
  17701.         and elem_gt : (elem * elem -> bool)
  17702.         and empty: set
  17703.         and exists: (elem * set) -> bool
  17704.         and find : (elem * set)  ->  elem option
  17705.         and fold: ((elem * 'b) -> 'b) -> set -> 'b -> 'b
  17706.         and insert: (elem * set) -> set
  17707.         and is_empty: set -> bool
  17708.         and make_list: set -> elem list
  17709.         and make_set: (elem list -> set)
  17710.         and partition: (elem -> bool) -> (set -> set * set)
  17711.         and remove: (elem * set) -> set
  17712.         and revfold: ((elem * 'b) -> 'b) -> set -> 'b -> 'b
  17713.         and select_arb: set -> elem
  17714.         and set_eq: (set * set) -> bool
  17715.         and set_gt: (set * set) -> bool
  17716.         and singleton: (elem -> set)
  17717.         and union: set * set -> set
  17718.      end
  17719.  
  17720.   signature TABLE =
  17721.      sig
  17722.       type 'a table
  17723.       type key
  17724.       val size : 'a table -> int
  17725.       val empty: 'a table
  17726.       val exists: (key * 'a table) -> bool
  17727.       val find : (key * 'a table)  ->  'a option
  17728.       val insert: ((key * 'a) * 'a table) -> 'a table
  17729.       val make_table : (key * 'a ) list -> 'a table
  17730.       val make_list : 'a table -> (key * 'a) list
  17731.       val fold : ((key * 'a) * 'b -> 'b) -> 'a table -> 'b -> 'b
  17732.      end
  17733.  
  17734.   signature HASH =
  17735.     sig
  17736.       type table
  17737.       type elem
  17738.  
  17739.       val size : table -> int
  17740.       val add : elem * table -> table
  17741.       val find : elem * table -> int option
  17742.       val exists : elem * table -> bool
  17743.       val empty : table
  17744.     end;
  17745.  
  17746.   (* Cribbed from...
  17747.      ML-Yacc Parser Generator (c) 1989 Andrew W. Appel, David R. Tarditi *)
  17748.  
  17749.   (*III
  17750.   import "tarditi.sig";
  17751.   III*)
  17752.  
  17753.   (* Implementation of ordered sets using ordered lists and red-black trees.  The
  17754.      code for red-black trees was originally written by Norris Boyd, which was
  17755.      modified for use here.
  17756.   *)   
  17757.  
  17758.   (* ordered sets implemented using ordered lists.
  17759.  
  17760.      Upper bound running times for functions implemented here:
  17761.  
  17762.      app  = O(n)
  17763.      card = O(n)
  17764.      closure = O(n^2)
  17765.      difference = O(n+m), where n,m = the size of the two sets used here.
  17766.      empty = O(1)
  17767.      exists = O(n)
  17768.      find = O(n)
  17769.      fold = O(n)
  17770.      insert = O(n)
  17771.      is_empty = O(1)
  17772.      make_list = O(1)
  17773.      make_set = O(n^2)
  17774.      partition = O(n)
  17775.      remove = O(n)
  17776.      revfold = O(n)
  17777.      select_arb = O(1)
  17778.      set_eq = O(n), where n = the cardinality of the smaller set
  17779.      set_gt = O(n), ditto
  17780.      singleton = O(1)
  17781.      union = O(n+m)
  17782.   *)
  17783.  
  17784.   functor ListOrdSet(B : sig type elem
  17785.               val gt : elem * elem -> bool
  17786.               val eq : elem * elem -> bool
  17787.               end ) : ORDSET =
  17788.  
  17789.   struct
  17790.    type elem = B.elem
  17791.    val elem_gt = B.gt
  17792.    val elem_eq = B.eq 
  17793.  
  17794.    type set = elem list
  17795.    exception Select_arb
  17796.    val empty = nil
  17797.  
  17798.    val insert = fn (key,s) =>
  17799.       let fun f (l as (h::t)) =
  17800.            if elem_gt(key,h) then h::(f t)
  17801.            else if elem_eq(key,h) then key::t
  17802.            else key::l
  17803.         | f nil = [key]
  17804.       in f s
  17805.       end
  17806.  
  17807.    val select_arb = fn nil => raise Select_arb
  17808.              | a::b => a
  17809.  
  17810.    val exists = fn (key,s) =>
  17811.       let fun f (h::t) = if elem_gt(key,h) then f t
  17812.                  else elem_eq(h,key) 
  17813.         | f nil = false
  17814.       in f s
  17815.       end
  17816.  
  17817.    val find = fn (key,s) =>
  17818.       let fun f (h::t) = if elem_gt(key,h) then f t
  17819.                  else if elem_eq(h,key) then SOME h
  17820.                  else NONE
  17821.         | f nil = NONE
  17822.       in f s
  17823.       end
  17824.  
  17825.    val revfold = List.revfold
  17826.    val fold = List.fold
  17827.    val app = List.app
  17828.  
  17829.   fun set_eq(h::t,h'::t') = 
  17830.       (case elem_eq(h,h')
  17831.         of true => set_eq(t,t')
  17832.          | a => a)
  17833.     | set_eq(nil,nil) = true
  17834.     | set_eq _ = false
  17835.  
  17836.   fun set_gt(h::t,h'::t') =
  17837.       (case elem_gt(h,h')
  17838.         of false => (case (elem_eq(h,h'))
  17839.               of true => set_gt(t,t')
  17840.                | a => a)
  17841.          |  a => a)
  17842.     | set_gt(_::_,nil) = true
  17843.     | set_gt _ = false
  17844.  
  17845.   fun union(a as (h::t),b as (h'::t')) =
  17846.         if elem_gt(h',h) then h::union(t,b)
  17847.         else if elem_eq(h,h') then h::union(t,t')
  17848.         else h'::union(a,t')
  17849.     | union(nil,s) = s
  17850.     | union(s,nil) = s
  17851.  
  17852.   val make_list = fn s => s
  17853.  
  17854.   val is_empty = fn nil => true | _ => false
  17855.  
  17856.   val make_set = fn l => List.fold insert l nil
  17857.  
  17858.   val partition = fn f => fn s =>
  17859.       fold (fn (e,(yes,no)) =>
  17860.           if (f e) then (e::yes,no) else (e::no,yes)) s (nil,nil)
  17861.  
  17862.   val remove = fn (e,s) =>
  17863.       let fun f (l as (h::t)) = if elem_gt(h,e) then l
  17864.                 else if elem_eq(h,e) then t
  17865.                 else h::(f t)
  17866.         | f nil = nil
  17867.       in f s
  17868.       end
  17869.  
  17870.    (* difference: X-Y *)
  17871.  
  17872.    fun difference (nil,_) = nil
  17873.      | difference (r,nil) = r
  17874.      | difference (a as (h::t),b as (h'::t')) =
  17875.         if elem_gt (h',h) then h::difference(t,b)
  17876.         else if elem_eq(h',h) then difference(t,t')
  17877.         else difference(a,t')
  17878.  
  17879.    fun singleton X = [X]
  17880.  
  17881.    fun card(S) = fold (fn (a,count) => count+1) S 0
  17882.  
  17883.     local
  17884.           fun closure'(from, f, result) =
  17885.         if is_empty from then result
  17886.         else
  17887.           let val (more,result) =
  17888.               fold (fn (a,(more',result')) =>
  17889.                   let val more = f a
  17890.                       val new = difference(more,result)
  17891.                   in (union(more',new),union(result',new))
  17892.                   end) from
  17893.                    (empty,result)
  17894.           in closure'(more,f,result)
  17895.           end
  17896.     in
  17897.        fun closure(start, f) = closure'(start, f, start)
  17898.     end
  17899.   end
  17900.  
  17901.   (* ordered set implemented using red-black trees:
  17902.  
  17903.      Upper bound running time of the functions below:
  17904.  
  17905.      app: O(n)
  17906.      card: O(n)
  17907.      closure: O(n^2 ln n)
  17908.      difference: O(n ln n)
  17909.      empty: O(1)
  17910.      exists: O(ln n)
  17911.      find: O(ln n)
  17912.      fold: O(n)
  17913.      insert: O(ln n)
  17914.      is_empty: O(1)
  17915.      make_list: O(n)
  17916.      make_set: O(n ln n)
  17917.      partition: O(n ln n)
  17918.      remove: O(n ln n)
  17919.      revfold: O(n)
  17920.      select_arb: O(1)
  17921.      set_eq: O(n)
  17922.      set_gt: O(n)
  17923.      singleton: O(1)
  17924.      union: O(n ln n)
  17925.   *)
  17926.  
  17927.   functor RbOrdSet (B : sig type elem
  17928.                val eq : (elem*elem) -> bool
  17929.                val gt : (elem*elem) -> bool
  17930.                end
  17931.           ) : ORDSET =
  17932.   struct
  17933.  
  17934.    type elem = B.elem
  17935.    val elem_gt = B.gt
  17936.    val elem_eq = B.eq 
  17937.  
  17938.    datatype Color = RED | BLACK
  17939.  
  17940.    abstype set = EMPTY | TREE of (B.elem * Color * set * set)
  17941.    with exception Select_arb
  17942.     val empty = EMPTY
  17943.  
  17944.    fun insert(key,t) =
  17945.     let fun f EMPTY = TREE(key,RED,EMPTY,EMPTY)
  17946.       | f (TREE(k,BLACK,l,r)) =
  17947.           if elem_gt (key,k)
  17948.           then case f r
  17949.            of r as TREE(rk,RED, rl as TREE(rlk,RED,rll,rlr),rr) =>
  17950.               (case l
  17951.                of TREE(lk,RED,ll,lr) =>
  17952.                   TREE(k,RED,TREE(lk,BLACK,ll,lr),
  17953.                          TREE(rk,BLACK,rl,rr))
  17954.                 | _ => TREE(rlk,BLACK,TREE(k,RED,l,rll),
  17955.                           TREE(rk,RED,rlr,rr)))
  17956.             | r as TREE(rk,RED,rl, rr as TREE(rrk,RED,rrl,rrr)) =>
  17957.               (case l
  17958.                of TREE(lk,RED,ll,lr) =>
  17959.                   TREE(k,RED,TREE(lk,BLACK,ll,lr),
  17960.                          TREE(rk,BLACK,rl,rr))
  17961.                 | _ => TREE(rk,BLACK,TREE(k,RED,l,rl),rr))
  17962.             | r => TREE(k,BLACK,l,r)
  17963.           else if elem_gt(k,key)
  17964.           then case f l
  17965.            of l as TREE(lk,RED,ll, lr as TREE(lrk,RED,lrl,lrr)) =>
  17966.               (case r
  17967.                of TREE(rk,RED,rl,rr) =>
  17968.                   TREE(k,RED,TREE(lk,BLACK,ll,lr),
  17969.                          TREE(rk,BLACK,rl,rr))
  17970.                 | _ => TREE(lrk,BLACK,TREE(lk,RED,ll,lrl),
  17971.                           TREE(k,RED,lrr,r)))
  17972.             | l as TREE(lk,RED, ll as TREE(llk,RED,lll,llr), lr) =>
  17973.               (case r
  17974.                of TREE(rk,RED,rl,rr) =>
  17975.                   TREE(k,RED,TREE(lk,BLACK,ll,lr),
  17976.                          TREE(rk,BLACK,rl,rr))
  17977.                 | _ => TREE(lk,BLACK,ll,TREE(k,RED,lr,r)))
  17978.             | l => TREE(k,BLACK,l,r)
  17979.           else TREE(key,BLACK,l,r)
  17980.       | f (TREE(k,RED,l,r)) =
  17981.           if elem_gt(key,k) then TREE(k,RED,l, f r)
  17982.           else if elem_gt(k,key) then TREE(k,RED, f l, r)
  17983.           else TREE(key,RED,l,r)
  17984.      in case f t
  17985.     of TREE(k,RED, l as TREE(_,RED,_,_), r) => TREE(k,BLACK,l,r)
  17986.      | TREE(k,RED, l, r as TREE(_,RED,_,_)) => TREE(k,BLACK,l,r)
  17987.      | t => t
  17988.     end
  17989.  
  17990.    fun select_arb (TREE(k,_,l,r)) = k
  17991.      | select_arb EMPTY = raise Select_arb
  17992.  
  17993.    fun exists(key,t) =
  17994.     let fun look EMPTY = false
  17995.       | look (TREE(k,_,l,r)) =
  17996.           if elem_gt(k,key) then look l
  17997.           else if elem_gt(key,k) then look r
  17998.           else true
  17999.      in look t
  18000.      end
  18001.  
  18002.    fun find(key,t) =
  18003.     let fun look EMPTY = NONE
  18004.       | look (TREE(k,_,l,r)) =
  18005.           if elem_gt(k,key) then look l
  18006.           else if elem_gt(key,k) then look r
  18007.           else SOME k
  18008.      in look t
  18009.     end
  18010.  
  18011.     fun revfold f t start =
  18012.        let fun scan (EMPTY,value) = value
  18013.          | scan (TREE(k,_,l,r),value) = scan(r,f(k,scan(l,value)))
  18014.        in scan(t,start)
  18015.        end
  18016.  
  18017.      fun fold f t start =
  18018.       let fun scan(EMPTY,value) = value
  18019.         | scan(TREE(k,_,l,r),value) = scan(l,f(k,scan(r,value)))
  18020.       in scan(t,start)
  18021.       end
  18022.  
  18023.      fun app f t =
  18024.     let fun scan EMPTY = ()
  18025.           | scan(TREE(k,_,l,r)) = (scan l; f k; scan r)
  18026.     in scan t
  18027.     end
  18028.  
  18029.   (* equal_tree : test if two trees are equal.  Two trees are equal if
  18030.      the set of leaves are equal *)
  18031.  
  18032.      fun set_eq (tree1 as (TREE _),tree2 as (TREE _)) =
  18033.        let datatype pos = L | R | M
  18034.        exception Done
  18035.        fun getvalue(stack as ((a,position)::b)) =
  18036.           (case a
  18037.            of (TREE(k,_,l,r)) =>
  18038.           (case position
  18039.            of L => getvalue ((l,L)::(a,M)::b)
  18040.             | M => (k,case r of  EMPTY => b | _ => (a,R)::b)
  18041.             | R => getvalue ((r,L)::b)
  18042.            )
  18043.         | EMPTY => getvalue b
  18044.            )
  18045.           | getvalue(nil) = raise Done
  18046.         fun f (nil,nil) = true
  18047.           | f (s1 as (_ :: _),s2 as (_ :: _ )) =
  18048.                 let val (v1,news1) = getvalue s1
  18049.                 and (v2,news2) = getvalue s2
  18050.                 in (elem_eq(v1,v2)) andalso f(news1,news2)
  18051.                 end
  18052.           | f _ = false
  18053.     in f ((tree1,L)::nil,(tree2,L)::nil) handle Done => false
  18054.     end
  18055.       | set_eq (EMPTY,EMPTY) = true
  18056.       | set_eq _ = false
  18057.  
  18058.      (* gt_tree : Test if tree1 is greater than tree 2 *)
  18059.  
  18060.      fun set_gt (tree1,tree2) =
  18061.        let datatype pos = L | R | M
  18062.        exception Done
  18063.        fun getvalue(stack as ((a,position)::b)) =
  18064.           (case a
  18065.            of (TREE(k,_,l,r)) =>
  18066.           (case position
  18067.            of L => getvalue ((l,L)::(a,M)::b)
  18068.             | M => (k,case r of EMPTY => b | _ => (a,R)::b)
  18069.             | R => getvalue ((r,L)::b)
  18070.            )
  18071.         | EMPTY => getvalue b
  18072.            )
  18073.           | getvalue(nil) = raise Done
  18074.         fun f (nil,nil) = false
  18075.           | f (s1 as (_ :: _),s2 as (_ :: _ )) =
  18076.                 let val (v1,news1) = getvalue s1
  18077.                 and (v2,news2) = getvalue s2
  18078.                 in (elem_gt(v1,v2)) orelse (elem_eq(v1,v2) andalso f(news1,news2))
  18079.                 end
  18080.           | f (_,nil) = true
  18081.           | f (nil,_) = false
  18082.     in f ((tree1,L)::nil,(tree2,L)::nil) handle Done => false
  18083.     end
  18084.  
  18085.     fun is_empty S = (let val _ = select_arb S in false end
  18086.                handle Select_arb => true)
  18087.  
  18088.     fun make_list S = fold (op ::) S nil
  18089.  
  18090.     fun make_set l = List.fold insert l empty
  18091.  
  18092.     fun partition F S = fold (fn (a,(Yes,No)) =>
  18093.                   if F(a) then (insert(a,Yes),No)
  18094.                   else (Yes,insert(a,No)))
  18095.                    S (empty,empty)
  18096.  
  18097.     fun remove(X, XSet) =
  18098.            let val (YSet, _) =
  18099.               partition (fn a => not (elem_eq (X, a))) XSet
  18100.            in  YSet
  18101.            end
  18102.  
  18103.     fun difference(Xs, Ys) =
  18104.          fold (fn (p as (a,Xs')) =>
  18105.             if exists(a,Ys) then Xs' else insert p)
  18106.          Xs empty
  18107.  
  18108.     fun singleton X = insert(X,empty)
  18109.  
  18110.     fun card(S) = fold (fn (_,count) => count+1) S 0
  18111.  
  18112.     fun union(Xs,Ys)= fold insert Ys Xs
  18113.  
  18114.     local
  18115.           fun closure'(from, f, result) =
  18116.         if is_empty from then result
  18117.         else
  18118.           let val (more,result) =
  18119.               fold (fn (a,(more',result')) =>
  18120.                   let val more = f a
  18121.                       val new = difference(more,result)
  18122.                   in (union(more',new),union(result',new))
  18123.                   end) from
  18124.                    (empty,result)
  18125.           in closure'(more,f,result)
  18126.           end
  18127.     in
  18128.        fun closure(start, f) = closure'(start, f, start)
  18129.     end
  18130.      end
  18131.   end
  18132.  
  18133.   (*
  18134.   signature TABLE =
  18135.      sig
  18136.       type 'a table
  18137.       type key
  18138.       val size : 'a table -> int
  18139.       val empty: 'a table
  18140.       val exists: (key * 'a table) -> bool
  18141.       val find : (key * 'a table)  ->  'a option
  18142.       val insert: ((key * 'a) * 'a table) -> 'a table
  18143.       val make_table : (key * 'a ) list -> 'a table
  18144.       val make_list : 'a table -> (key * 'a) list
  18145.       val fold : ((key * 'a) * 'b -> 'b) -> 'a table -> 'b -> 'b
  18146.      end
  18147.   *)
  18148.  
  18149.   functor Table (B : sig type key
  18150.             val gt : (key * key) -> bool
  18151.                end
  18152.           ) : TABLE =
  18153.   struct
  18154.  
  18155.    datatype Color = RED | BLACK
  18156.    type key = B.key
  18157.  
  18158.    abstype 'a table = EMPTY
  18159.             | TREE of ((B.key * 'a ) * Color * 'a table * 'a table)
  18160.    with
  18161.  
  18162.    val empty = EMPTY
  18163.  
  18164.    fun insert(elem as (key,data),t) =
  18165.     let val key_gt = fn (a,_) => B.gt(key,a)
  18166.     val key_lt = fn (a,_) => B.gt(a,key)
  18167.       fun f EMPTY = TREE(elem,RED,EMPTY,EMPTY)
  18168.       | f (TREE(k,BLACK,l,r)) =
  18169.           if key_gt k
  18170.           then case f r
  18171.            of r as TREE(rk,RED, rl as TREE(rlk,RED,rll,rlr),rr) =>
  18172.               (case l
  18173.                of TREE(lk,RED,ll,lr) =>
  18174.                   TREE(k,RED,TREE(lk,BLACK,ll,lr),
  18175.                          TREE(rk,BLACK,rl,rr))
  18176.                 | _ => TREE(rlk,BLACK,TREE(k,RED,l,rll),
  18177.                           TREE(rk,RED,rlr,rr)))
  18178.             | r as TREE(rk,RED,rl, rr as TREE(rrk,RED,rrl,rrr)) =>
  18179.               (case l
  18180.                of TREE(lk,RED,ll,lr) =>
  18181.                   TREE(k,RED,TREE(lk,BLACK,ll,lr),
  18182.                          TREE(rk,BLACK,rl,rr))
  18183.                 | _ => TREE(rk,BLACK,TREE(k,RED,l,rl),rr))
  18184.             | r => TREE(k,BLACK,l,r)
  18185.           else if key_lt k
  18186.           then case f l
  18187.            of l as TREE(lk,RED,ll, lr as TREE(lrk,RED,lrl,lrr)) =>
  18188.               (case r
  18189.                of TREE(rk,RED,rl,rr) =>
  18190.                   TREE(k,RED,TREE(lk,BLACK,ll,lr),
  18191.                          TREE(rk,BLACK,rl,rr))
  18192.                 | _ => TREE(lrk,BLACK,TREE(lk,RED,ll,lrl),
  18193.                           TREE(k,RED,lrr,r)))
  18194.             | l as TREE(lk,RED, ll as TREE(llk,RED,lll,llr), lr) =>
  18195.               (case r
  18196.                of TREE(rk,RED,rl,rr) =>
  18197.                   TREE(k,RED,TREE(lk,BLACK,ll,lr),
  18198.                          TREE(rk,BLACK,rl,rr))
  18199.                 | _ => TREE(lk,BLACK,ll,TREE(k,RED,lr,r)))
  18200.             | l => TREE(k,BLACK,l,r)
  18201.           else TREE(elem,BLACK,l,r)
  18202.       | f (TREE(k,RED,l,r)) =
  18203.           if key_gt k then TREE(k,RED,l, f r)
  18204.           else if key_lt k then TREE(k,RED, f l, r)
  18205.           else TREE(elem,RED,l,r)
  18206.      in case f t
  18207.     of TREE(k,RED, l as TREE(_,RED,_,_), r) => TREE(k,BLACK,l,r)
  18208.      | TREE(k,RED, l, r as TREE(_,RED,_,_)) => TREE(k,BLACK,l,r)
  18209.      | t => t
  18210.     end
  18211.  
  18212.    fun exists(key,t) =
  18213.     let fun look EMPTY = false
  18214.       | look (TREE((k,_),_,l,r)) =
  18215.           if B.gt(k,key) then look l
  18216.           else if B.gt(key,k) then look r
  18217.           else true
  18218.      in look t
  18219.      end
  18220.  
  18221.    fun find(key,t) =
  18222.     let fun look EMPTY = NONE
  18223.       | look (TREE((k,data),_,l,r)) =
  18224.           if B.gt(k,key) then look l
  18225.           else if B.gt(key,k) then look r
  18226.           else SOME data
  18227.      in look t
  18228.     end
  18229.  
  18230.     fun fold f t start =
  18231.       let fun scan(EMPTY,value) = value
  18232.         | scan(TREE(k,_,l,r),value) = scan(l,f(k,scan(r,value)))
  18233.       in scan(t,start)
  18234.       end
  18235.  
  18236.     fun make_table l = List.fold insert l empty
  18237.  
  18238.     fun size S = fold (fn (_,count) => count+1) S 0
  18239.  
  18240.     fun make_list table = fold (op ::) table nil
  18241.  
  18242.     end
  18243.   end;
  18244.  
  18245.   (* assumes that a functor Table with signature TABLE from table.sml is
  18246.      in the environment *)
  18247.  
  18248.   (*
  18249.   signature HASH =
  18250.     sig
  18251.       type table
  18252.       type elem
  18253.  
  18254.       val size : table -> int
  18255.       val add : elem * table -> table
  18256.       val find : elem * table -> int option
  18257.       val exists : elem * table -> bool
  18258.       val empty : table
  18259.     end
  18260.   *)
  18261.  
  18262.   (* hash: creates a hash table of size n which assigns each distinct member
  18263.      a unique integer between 0 and n-1 *)
  18264.  
  18265.   functor Hash(B : sig type elem
  18266.                val gt : elem * elem -> bool
  18267.            end) : HASH =
  18268.   struct
  18269.       type elem=B.elem
  18270.       structure HashTable = Table(type key=B.elem
  18271.                   val gt = B.gt)
  18272.  
  18273.       type table = {count : int, table : int HashTable.table}
  18274.  
  18275.       val empty = {count=0,table=HashTable.empty}
  18276.       val size = fn {count,table} => count
  18277.       val add = fn (e,{count,table}) =>
  18278.           {count=count+1,table=HashTable.insert((e,count),table)}
  18279.       val find = fn (e,{table,count}) => HashTable.find(e,table)
  18280.       val exists = fn (e,{table,count}) => HashTable.exists(e,table)
  18281.   end;
  18282.   (*III
  18283.   import "interface.sig";
  18284.   III*)
  18285.  
  18286.   functor Interface () : INTERFACE =
  18287.   struct
  18288.  
  18289.   type pos = int
  18290.   val line = ref 0
  18291.   fun init_line () = (line := 0)
  18292.   fun next_line () = (line := !line + 1)
  18293.   fun error (errmsg,line:pos,_) =
  18294.     output (std_out, ("Line " ^ (makestring line) ^ ": " ^ errmsg ^ "\n"))
  18295.  
  18296.   end  (* functor INTERFACE *)
  18297.   functor Globals(
  18298.           structure Wr: WR
  18299.           structure Pp: PP
  18300.           structure WrMgt: WRMGT
  18301.           structure ListUtils: LISTUTILS
  18302.           structure StringUtils: STRINGUTILS
  18303.           structure DebugUtils: DEBUGUTILS
  18304.           structure Id: ID
  18305.           structure Registry: REGISTRY
  18306.           sharing Pp.Wr = Wr
  18307.           and WrMgt.Pp = Pp
  18308.           and type Registry.registeredtype = bool
  18309.           ) : GLOBALS 
  18310.           = struct
  18311.  
  18312.   structure Wr = Wr;
  18313.   open Wr;
  18314.  
  18315.   structure Pp = Pp;
  18316.   open Pp;
  18317.  
  18318.   structure WrMgt = WrMgt;
  18319.   open WrMgt;
  18320.  
  18321.   structure Id = Id;
  18322.  
  18323.   structure Registry = Registry
  18324.  
  18325.   open ListUtils
  18326.   open StringUtils
  18327.   open DebugUtils
  18328.   open Registry
  18329.  
  18330.   exception CantHappen
  18331.  
  18332.   end
  18333.  
  18334.   signature TRMPVT = sig
  18335.  
  18336.   structure Globals: GLOBALS
  18337.   structure Typ: TYPPVT
  18338.   sharing Typ.Globals = Globals
  18339.   open Globals
  18340.  
  18341.   datatype pretrm = 
  18342.           PREVAR of Id.T
  18343.         | PREABS of Id.T * Typ.pretyp * pretrm
  18344.         | PREAPP of pretrm * pretrm
  18345.         | PRETABS of Id.T * Typ.pretyp * pretrm
  18346.         | PRETAPP of pretrm * Typ.pretyp
  18347.         | PREFOR of Id.T * (Typ.pretyp list) * pretrm
  18348.  
  18349.   datatype T = 
  18350.           VAR of unit * int
  18351.         | ABS of {name:Id.T} * Typ.T * T
  18352.         | APP of unit * T * T
  18353.         | TABS of {name:Id.T} * Typ.T * T
  18354.         | TAPP of unit * T * Typ.T
  18355.         | FOR of {name:Id.T} * (Typ.T list) * T
  18356.  
  18357.   exception UnknownId of string
  18358.   val debruijnify: Typ.tenv -> pretrm -> T
  18359.  
  18360.   val prt: Pp.Pp -> Typ.tenv -> T -> unit
  18361.  
  18362.   end
  18363.  
  18364.   functor DebugUtils(
  18365.           structure WrMgt: WRMGT
  18366.           ) : DEBUGUTILS = struct
  18367.  
  18368.   open WrMgt
  18369.   open Pp;
  18370.  
  18371.   val level = ref(0);
  18372.  
  18373.   (* $$$ belongs in globals: *)
  18374.   fun unwind_protect f cleanup =
  18375.     (f())
  18376.     handle e => (cleanup(); raise e)
  18377.  
  18378.   fun do_wrap pp name f pbefore pafter =
  18379.     (pwrite pp "[";
  18380.      setb pp;  
  18381.      pwrite pp (makestring (!level));
  18382.      pwrite pp "] ";
  18383.      pwrite pp name;
  18384.      pwrite pp "? ";
  18385.      pbefore();
  18386.      pwrite pp "\n";
  18387.      level := (!level) + 1;
  18388.      let val result = unwind_protect 
  18389.               f
  18390.               (fn () => level := (!level) - 1)
  18391.      in
  18392.     level := (!level) - 1;
  18393.     break pp true ~3;
  18394.     pwrite pp "   [";
  18395.     pwrite pp (makestring (!level));
  18396.     pwrite pp "] ";
  18397.     pwrite pp name;
  18398.     pwrite pp ": ";
  18399.     pafter(result);
  18400.     pwrite pp "\n";
  18401.     endb pp;
  18402.     result
  18403.      end
  18404.     )
  18405.  
  18406.   fun wrap DEBUG name f pbefore pafter =
  18407.     if (not (!DEBUG))
  18408.       then f()
  18409.       else do_wrap (stdpp()) name f pbefore pafter;
  18410.  
  18411.   end
  18412.   functor Trm(
  18413.           structure Globals: GLOBALS
  18414.           structure Typ: TYPPVT
  18415.           sharing Typ.Globals = Globals
  18416.           ) : TRMPVT
  18417.           = struct
  18418.  
  18419.   structure Globals = Globals
  18420.   structure Typ = Typ
  18421.   open Globals
  18422.   open Typ
  18423.   open Pp
  18424.  
  18425.   datatype pretrm = 
  18426.           PREVAR of Id.T
  18427.         | PREABS of Id.T * pretyp * pretrm
  18428.         | PREAPP of pretrm * pretrm
  18429.         | PRETABS of Id.T * pretyp * pretrm
  18430.         | PRETAPP of pretrm * pretyp
  18431.         | PREFOR of Id.T * (pretyp list) * pretrm
  18432.  
  18433.   datatype T = 
  18434.           VAR of unit * int
  18435.         | ABS of {name:Id.T} * Typ.T * T
  18436.         | APP of unit * T * T
  18437.         | TABS of {name:Id.T} * Typ.T * T
  18438.         | TAPP of unit * T * Typ.T
  18439.         | FOR of {name:Id.T} * (Typ.T list) * T
  18440.  
  18441.   fun debruijnify te (PREVAR i) =
  18442.     VAR((), index te i)
  18443.     | debruijnify te (PREABS(i,ptyp,ptrm)) =
  18444.     ABS({name=i}, Typ.debruijnify te ptyp, 
  18445.               debruijnify (push_binding te i NS) ptrm)
  18446.     | debruijnify te (PREAPP(ptrm1,ptrm2)) =
  18447.     APP((), debruijnify te ptrm1, debruijnify te ptrm2)
  18448.     | debruijnify te (PRETABS(i,ptyp,ptrm)) =
  18449.     TABS({name=i}, Typ.debruijnify te ptyp, 
  18450.                debruijnify (push_bound te i NS) ptrm)
  18451.     | debruijnify te (PRETAPP(ptrm,ptyp)) =
  18452.     TAPP((), debruijnify te ptrm, Typ.debruijnify te ptyp)
  18453.     | debruijnify te (PREFOR(i,ptyps,ptrm)) =
  18454.     FOR({name=i}, map (fn pt => Typ.debruijnify te pt) ptyps, 
  18455.                debruijnify (push_bound te i NS) ptrm)
  18456.  
  18457.   fun prt pp te trm =
  18458.     let fun p te (VAR(_,i)) =
  18459.         Pp.pwrite pp (Id.tostr (lookup_name te i))
  18460.       | p te (ABS({name=i},t,body)) =
  18461.         (Pp.pwrite pp "(\\";
  18462.          Pp.pwrite pp (Id.tostr i);
  18463.          Pp.pwrite pp ":";
  18464.          Typ.prt pp te t;
  18465.          Pp.pwrite pp ". ";
  18466.          p (push_binding te i t) body;
  18467.          Pp.pwrite pp ")")
  18468.       | p te (APP(_,trm1,trm2)) =
  18469.         (Pp.pwrite pp "(";
  18470.          p te trm1;
  18471.          Pp.pwrite pp " ";
  18472.          p te trm2;
  18473.          Pp.pwrite pp ")")
  18474.       | p te (TABS({name=i},t,body)) =
  18475.         (Pp.pwrite pp "(\\\\";
  18476.          Pp.pwrite pp (Id.tostr i);
  18477.          Pp.pwrite pp "<=";
  18478.          Typ.prt pp te t;
  18479.          Pp.pwrite pp ". ";
  18480.          p (push_bound te i t) body;
  18481.          Pp.pwrite pp ")")
  18482.       | p te (TAPP(_,trm1,t)) =
  18483.         (Pp.pwrite pp "(";
  18484.          p te trm1;
  18485.          Pp.pwrite pp " [";
  18486.          Typ.prt pp te t;
  18487.          Pp.pwrite pp "])")
  18488.       | p te (FOR({name=i},ts,body)) =
  18489.         (Pp.pwrite pp "(for ";
  18490.          Pp.pwrite pp (Id.tostr i);
  18491.          Pp.pwrite pp " in ";
  18492.          mapunit_tuple (fn t => Typ.prt pp te t) (fn () => Pp.pwrite pp ",") ts;
  18493.          Pp.pwrite pp ". ";
  18494.          p (push_abbrev te i NS) body;
  18495.          Pp.pwrite pp ")")
  18496.     in p te trm
  18497.     end
  18498.  
  18499.   end
  18500.   functor ListUtils() : LISTUTILS = struct
  18501.  
  18502.   fun mapunit f l = 
  18503.     let fun mu [] = ()
  18504.       | mu (hd::tl) = (f hd; mu tl)
  18505.     in mu l
  18506.     end
  18507.  
  18508.   fun mapunit_tuple f betw ts =
  18509.     let fun mut [] = ()
  18510.       | mut [e] = f e
  18511.       | mut (e::tl) = (f e; betw(); mut tl)
  18512.     in mut ts
  18513.     end
  18514.  
  18515.   fun mapfold fm ff z =
  18516.     let fun m []       = z
  18517.       | m (hd::tl) = ff (fm hd) (m tl)
  18518.     in m
  18519.     end
  18520.  
  18521.   fun memq eq l e =
  18522.     let fun m [] = false
  18523.       | m (hd::tl) = (eq e hd) orelse (m tl)
  18524.     in m l
  18525.     end
  18526.  
  18527.   fun mapappend f l =
  18528.     let fun ma [] = []
  18529.       | ma (hd::tl) = (f hd) @ (ma tl)
  18530.     in ma l
  18531.     end
  18532.  
  18533.   fun filter b l =
  18534.     let fun f [] = []
  18535.       | f (hd::tl) = if (b hd) then hd::(f tl) else f tl
  18536.     in f l
  18537.     end
  18538.  
  18539.   fun forall f = mapfold f (fn x => fn y => x andalso y) true
  18540.  
  18541.   fun forsome f = mapfold f (fn x => fn y => x orelse y) false
  18542.  
  18543.   end
  18544.   functor Synth(
  18545.           structure Globals: GLOBALS
  18546.           structure Typ: TYPPVT
  18547.           structure Trm: TRMPVT
  18548.           structure Leq: LEQ
  18549.           sharing Typ.Globals = Globals
  18550.           and Trm.Typ = Typ
  18551.           and Leq.Typ = Typ
  18552.           ) : SYNTH = struct
  18553.  
  18554.   structure Globals = Globals
  18555.   structure Typ = Typ
  18556.   structure Trm = Trm
  18557.   structure Leq = Leq
  18558.   open Globals
  18559.   open Typ
  18560.   open Trm
  18561.  
  18562.   val DEBUG = ref(false)
  18563.   val _ = (registerflag "synth" DEBUG;
  18564.        registerflag "Synth" DEBUG)
  18565.  
  18566.   fun arrowbasis te t = 
  18567.     let fun ab (TVAR(_,v)) = 
  18568.           (case lookup_and_relocate te v of
  18569.           BND(_,b) => ab b
  18570.         | VBND(n,b) => raise Typ.WrongKindOfId(te,v,"tvar or abbrev")
  18571.         | ABB(_,b) => ab b)
  18572.       | ab (t as ARROW(_)) =
  18573.           [t]
  18574.       | ab (ALL(_)) =
  18575.           []
  18576.       | ab (MEET(_,ts)) =
  18577.           mapappend ab ts
  18578.     in ab t
  18579.     end
  18580.  
  18581.   fun allbasis te t = 
  18582.     let fun ab (TVAR(_,v)) = 
  18583.           (case lookup_and_relocate te v of
  18584.           BND(_,b) => ab b
  18585.         | VBND(n,b) => raise Typ.WrongKindOfId(te,v,"tvar or abbrev")
  18586.         | ABB(_,b) => ab b)
  18587.       | ab (t as ARROW(_)) =
  18588.           []
  18589.       | ab (t as ALL(_)) =
  18590.           [t]
  18591.       | ab (MEET(_,ts)) =
  18592.           mapappend ab ts
  18593.     in ab t
  18594.     end
  18595.  
  18596.   fun synth' te (VAR(_,v)) = Typ.lookup_and_relocate_binding te v
  18597.     | synth' te (ABS({name=i},t,body)) = 
  18598.     let val t_body = synth (push_binding te i t) body
  18599.         val t' = relocate ~1 t_body
  18600.     in ARROW((),t,t')
  18601.     end
  18602.     | synth' te (APP(_,trm1,trm2)) = 
  18603.     let val t1 = synth te trm1
  18604.         and t2 = synth te trm2
  18605.         val basis = arrowbasis te t1
  18606.         fun collect_apps [] =
  18607.           []
  18608.           | collect_apps ((ARROW(_,tb1,tb2))::tl) = 
  18609.           if Leq.leq te t2 tb1
  18610.              then tb2::(collect_apps tl)
  18611.              else (collect_apps tl)
  18612.           | collect_apps _ = raise CantHappen
  18613.         val ts = collect_apps basis
  18614.     in MEET((),ts)
  18615.     end
  18616.     | synth' te (TABS({name=i},t,body)) = 
  18617.     let val t' = synth (push_bound te i t) body
  18618.     in ALL({name=i},t,t')
  18619.     end
  18620.     | synth' te (TAPP(_,body,t)) =
  18621.     let val t_body = synth te body
  18622.         val basis = allbasis te t_body
  18623.         fun collect_apps [] =
  18624.           []
  18625.           | collect_apps ((ALL(_,t1,t2))::tl) = 
  18626.           if Leq.leq te t t1
  18627.              then (tsubst_top t t2)::(collect_apps tl)
  18628.              else (collect_apps tl)
  18629.           | collect_apps _ = raise CantHappen
  18630.         val ts = collect_apps basis
  18631.     in MEET((),ts)
  18632.     end
  18633.     | synth' te (FOR({name=i},ts,body)) =
  18634.     let fun f t = 
  18635.         let val tb = synth (push_abbrev te i t) body
  18636.             val tb' = tsubst_top t tb
  18637.         in tb'
  18638.         end
  18639.     in MEET((), map f ts)
  18640.     end
  18641.  
  18642.   and synth te e =
  18643.     wrap (DEBUG) "synth"
  18644.      (fn () => synth' te e)
  18645.      (fn () => 
  18646.         (Trm.prt (stdpp()) te e;
  18647.          Pp.pwrite (stdpp()) "\n";
  18648.          Typ.prt_tenv (stdpp()) te))
  18649.      (fn t => 
  18650.         (Typ.prt (stdpp()) te t))
  18651.  
  18652.   end
  18653.  
  18654.   functor FMEETLrValsFun ( structure Token : TOKEN
  18655.                   structure Globals : GLOBALS
  18656.                   structure ParseRes : PARSERES
  18657.                 ) : FMEET_LRVALS = 
  18658.   struct
  18659.   structure ParserData=
  18660.   struct
  18661.   structure Header = 
  18662.   struct
  18663.   structure ParseRes = ParseRes
  18664.   open ParseRes
  18665.   open Trm
  18666.   open Typ
  18667.   open Globals
  18668.  
  18669.   end
  18670.   structure LrTable = Token.LrTable
  18671.   structure Token = Token
  18672.   local open LrTable in 
  18673.   val table=let val actionT =
  18674.   "\
  18675.   \\001\000\022\000\014\000\021\000\023\000\020\000\
  18676.   \\024\000\019\000\025\000\018\000\026\000\017\000\027\000\016\000\
  18677.   \\028\000\015\000\029\000\014\000\030\000\013\000\031\000\012\000\
  18678.   \\032\000\011\000\033\000\010\000\040\000\009\000\000\000\001\000\
  18679.   \\000\000\141\000\
  18680.   \\014\000\025\000\016\000\024\000\025\000\018\000\000\000\140\000\
  18681.   \\000\000\116\000\
  18682.   \\000\000\147\000\
  18683.   \\005\000\028\000\008\000\027\000\009\000\026\000\000\000\137\000\
  18684.   \\000\000\118\000\
  18685.   \\025\000\018\000\000\000\001\000\
  18686.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18687.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18688.   \\025\000\038\000\000\000\001\000\
  18689.   \\025\000\039\000\000\000\001\000\
  18690.   \\025\000\040\000\000\000\001\000\
  18691.   \\025\000\018\000\000\000\001\000\
  18692.   \\025\000\042\000\000\000\001\000\
  18693.   \\000\000\139\000\
  18694.   \\000\000\138\000\
  18695.   \\000\000\136\000\
  18696.   \\025\000\018\000\000\000\001\000\
  18697.   \\025\000\018\000\000\000\001\000\
  18698.   \\014\000\021\000\023\000\020\000\024\000\019\000\
  18699.   \\025\000\018\000\026\000\017\000\027\000\016\000\040\000\009\000\000\000\001\000\
  18700.   \\000\000\117\000\
  18701.   \\000\000\149\000\
  18702.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18703.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18704.   \\014\000\021\000\023\000\020\000\024\000\019\000\
  18705.   \\025\000\018\000\026\000\017\000\027\000\016\000\040\000\009\000\000\000\001\000\
  18706.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18707.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18708.   \\014\000\021\000\023\000\020\000\024\000\019\000\
  18709.   \\025\000\018\000\026\000\017\000\027\000\016\000\040\000\009\000\000\000\001\000\
  18710.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18711.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18712.   \\036\000\053\000\000\000\001\000\
  18713.   \\006\000\054\000\000\000\134\000\
  18714.   \\005\000\057\000\012\000\056\000\022\000\055\000\000\000\001\000\
  18715.   \\000\000\122\000\
  18716.   \\025\000\018\000\000\000\001\000\
  18717.   \\000\000\126\000\
  18718.   \\025\000\018\000\000\000\001\000\
  18719.   \\016\000\060\000\000\000\001\000\
  18720.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18721.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18722.   \\000\000\120\000\
  18723.   \\000\000\121\000\
  18724.   \\000\000\119\000\
  18725.   \\005\000\063\000\009\000\062\000\000\000\001\000\
  18726.   \\000\000\110\000\
  18727.   \\036\000\064\000\000\000\001\000\
  18728.   \\002\000\066\000\005\000\065\000\006\000\054\000\000\000\134\000\
  18729.   \\003\000\067\000\000\000\001\000\
  18730.   \\015\000\068\000\000\000\001\000\
  18731.   \\000\000\137\000\
  18732.   \\012\000\056\000\017\000\069\000\022\000\055\000\000\000\001\000\
  18733.   \\015\000\070\000\000\000\001\000\
  18734.   \\012\000\056\000\022\000\055\000\000\000\114\000\
  18735.   \\000\000\115\000\
  18736.   \\012\000\056\000\022\000\055\000\000\000\112\000\
  18737.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18738.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18739.   \\025\000\018\000\000\000\001\000\
  18740.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18741.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18742.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18743.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18744.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18745.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18746.   \\002\000\078\000\005\000\077\000\000\000\001\000\
  18747.   \\002\000\080\000\005\000\079\000\000\000\001\000\
  18748.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18749.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18750.   \\012\000\056\000\015\000\082\000\022\000\055\000\000\000\001\000\
  18751.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18752.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18753.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18754.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18755.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18756.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18757.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18758.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18759.   \\014\000\021\000\023\000\020\000\024\000\019\000\
  18760.   \\025\000\018\000\026\000\017\000\027\000\016\000\040\000\009\000\000\000\001\000\
  18761.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18762.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18763.   \\000\000\148\000\
  18764.   \\000\000\151\000\
  18765.   \\000\000\150\000\
  18766.   \\002\000\089\000\000\000\001\000\
  18767.   \\006\000\090\000\012\000\056\000\022\000\055\000\000\000\132\000\
  18768.   \\000\000\135\000\
  18769.   \\012\000\056\000\022\000\055\000\000\000\124\000\
  18770.   \\012\000\056\000\000\000\123\000\
  18771.   \\012\000\056\000\022\000\055\000\000\000\109\000\
  18772.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18773.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18774.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18775.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18776.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18777.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18778.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18779.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18780.   \\017\000\095\000\000\000\001\000\
  18781.   \\000\000\127\000\
  18782.   \\012\000\056\000\022\000\055\000\000\000\113\000\
  18783.   \\012\000\056\000\022\000\055\000\000\000\111\000\
  18784.   \\002\000\096\000\000\000\001\000\
  18785.   \\002\000\097\000\012\000\056\000\022\000\055\000\000\000\001\000\
  18786.   \\000\000\143\000\
  18787.   \\002\000\098\000\000\000\001\000\
  18788.   \\014\000\021\000\023\000\020\000\024\000\019\000\
  18789.   \\025\000\018\000\026\000\017\000\027\000\016\000\040\000\009\000\000\000\001\000\
  18790.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18791.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18792.   \\002\000\101\000\012\000\056\000\022\000\055\000\000\000\001\000\
  18793.   \\012\000\056\000\022\000\055\000\000\000\130\000\
  18794.   \\002\000\102\000\012\000\056\000\022\000\055\000\000\000\001\000\
  18795.   \\012\000\056\000\022\000\055\000\000\000\128\000\
  18796.   \\000\000\125\000\
  18797.   \\014\000\021\000\023\000\020\000\024\000\019\000\
  18798.   \\025\000\018\000\026\000\017\000\027\000\016\000\040\000\009\000\000\000\001\000\
  18799.   \\014\000\021\000\023\000\020\000\024\000\019\000\
  18800.   \\025\000\018\000\026\000\017\000\027\000\016\000\040\000\009\000\000\000\001\000\
  18801.   \\014\000\021\000\023\000\020\000\024\000\019\000\
  18802.   \\025\000\018\000\026\000\017\000\027\000\016\000\040\000\009\000\000\000\001\000\
  18803.   \\000\000\146\000\
  18804.   \\000\000\133\000\
  18805.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18806.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18807.   \\014\000\037\000\022\000\036\000\025\000\018\000\
  18808.   \\035\000\035\000\037\000\034\000\043\000\033\000\000\000\001\000\
  18809.   \\000\000\145\000\
  18810.   \\000\000\144\000\
  18811.   \\000\000\142\000\
  18812.   \\012\000\056\000\022\000\055\000\000\000\131\000\
  18813.   \\012\000\056\000\022\000\055\000\000\000\129\000\
  18814.   \\001\000\000\000\004\000\000\000\000\000\001\000\
  18815.   \"
  18816.   val gotoT =
  18817.   "\
  18818.   \\001\000\106\000\002\000\006\000\003\000\005\000\
  18819.   \\005\000\004\000\008\000\003\000\009\000\002\000\010\000\001\000\000\000\000\000\
  18820.   \\000\000\000\000\
  18821.   \\003\000\021\000\000\000\000\000\
  18822.   \\000\000\000\000\
  18823.   \\000\000\000\000\
  18824.   \\000\000\000\000\
  18825.   \\000\000\000\000\
  18826.   \\003\000\028\000\004\000\027\000\000\000\000\000\
  18827.   \\003\000\030\000\006\000\029\000\000\000\000\000\
  18828.   \\000\000\000\000\
  18829.   \\000\000\000\000\
  18830.   \\000\000\000\000\
  18831.   \\003\000\039\000\000\000\000\000\
  18832.   \\000\000\000\000\
  18833.   \\000\000\000\000\
  18834.   \\000\000\000\000\
  18835.   \\000\000\000\000\
  18836.   \\003\000\042\000\004\000\041\000\000\000\000\000\
  18837.   \\003\000\043\000\000\000\000\000\
  18838.   \\003\000\045\000\005\000\004\000\008\000\044\000\
  18839.   \\009\000\002\000\010\000\001\000\000\000\000\000\
  18840.   \\000\000\000\000\
  18841.   \\000\000\000\000\
  18842.   \\003\000\030\000\006\000\046\000\000\000\000\000\
  18843.   \\003\000\045\000\005\000\004\000\008\000\047\000\
  18844.   \\009\000\002\000\010\000\001\000\000\000\000\000\
  18845.   \\003\000\030\000\006\000\048\000\000\000\000\000\
  18846.   \\003\000\045\000\005\000\004\000\008\000\049\000\
  18847.   \\009\000\002\000\010\000\001\000\000\000\000\000\
  18848.   \\003\000\030\000\006\000\050\000\000\000\000\000\
  18849.   \\000\000\000\000\
  18850.   \\000\000\000\000\
  18851.   \\000\000\000\000\
  18852.   \\000\000\000\000\
  18853.   \\003\000\056\000\000\000\000\000\
  18854.   \\000\000\000\000\
  18855.   \\003\000\057\000\000\000\000\000\
  18856.   \\000\000\000\000\
  18857.   \\003\000\030\000\006\000\059\000\000\000\000\000\
  18858.   \\000\000\000\000\
  18859.   \\000\000\000\000\
  18860.   \\000\000\000\000\
  18861.   \\000\000\000\000\
  18862.   \\000\000\000\000\
  18863.   \\000\000\000\000\
  18864.   \\000\000\000\000\
  18865.   \\000\000\000\000\
  18866.   \\000\000\000\000\
  18867.   \\000\000\000\000\
  18868.   \\000\000\000\000\
  18869.   \\000\000\000\000\
  18870.   \\000\000\000\000\
  18871.   \\000\000\000\000\
  18872.   \\000\000\000\000\
  18873.   \\003\000\030\000\006\000\070\000\007\000\069\000\000\000\000\000\
  18874.   \\003\000\028\000\004\000\071\000\000\000\000\000\
  18875.   \\003\000\030\000\006\000\072\000\000\000\000\000\
  18876.   \\003\000\030\000\006\000\073\000\000\000\000\000\
  18877.   \\003\000\030\000\006\000\074\000\000\000\000\000\
  18878.   \\000\000\000\000\
  18879.   \\000\000\000\000\
  18880.   \\003\000\030\000\006\000\070\000\007\000\079\000\000\000\000\000\
  18881.   \\000\000\000\000\
  18882.   \\003\000\030\000\006\000\081\000\000\000\000\000\
  18883.   \\003\000\030\000\006\000\082\000\000\000\000\000\
  18884.   \\003\000\030\000\006\000\070\000\007\000\083\000\000\000\000\000\
  18885.   \\003\000\030\000\006\000\084\000\000\000\000\000\
  18886.   \\003\000\045\000\005\000\004\000\008\000\085\000\
  18887.   \\009\000\002\000\010\000\001\000\000\000\000\000\
  18888.   \\003\000\030\000\006\000\070\000\007\000\086\000\000\000\000\000\
  18889.   \\000\000\000\000\
  18890.   \\000\000\000\000\
  18891.   \\000\000\000\000\
  18892.   \\000\000\000\000\
  18893.   \\000\000\000\000\
  18894.   \\000\000\000\000\
  18895.   \\000\000\000\000\
  18896.   \\000\000\000\000\
  18897.   \\000\000\000\000\
  18898.   \\003\000\030\000\006\000\089\000\000\000\000\000\
  18899.   \\003\000\030\000\006\000\090\000\000\000\000\000\
  18900.   \\003\000\030\000\006\000\091\000\000\000\000\000\
  18901.   \\003\000\030\000\006\000\092\000\000\000\000\000\
  18902.   \\000\000\000\000\
  18903.   \\000\000\000\000\
  18904.   \\000\000\000\000\
  18905.   \\000\000\000\000\
  18906.   \\000\000\000\000\
  18907.   \\000\000\000\000\
  18908.   \\000\000\000\000\
  18909.   \\000\000\000\000\
  18910.   \\003\000\045\000\005\000\004\000\008\000\097\000\
  18911.   \\009\000\002\000\010\000\001\000\000\000\000\000\
  18912.   \\003\000\030\000\006\000\070\000\007\000\098\000\000\000\000\000\
  18913.   \\000\000\000\000\
  18914.   \\000\000\000\000\
  18915.   \\000\000\000\000\
  18916.   \\000\000\000\000\
  18917.   \\000\000\000\000\
  18918.   \\003\000\045\000\005\000\004\000\008\000\101\000\
  18919.   \\009\000\002\000\010\000\001\000\000\000\000\000\
  18920.   \\003\000\045\000\005\000\004\000\008\000\102\000\
  18921.   \\009\000\002\000\010\000\001\000\000\000\000\000\
  18922.   \\003\000\045\000\005\000\004\000\008\000\103\000\
  18923.   \\009\000\002\000\010\000\001\000\000\000\000\000\
  18924.   \\000\000\000\000\
  18925.   \\000\000\000\000\
  18926.   \\003\000\030\000\006\000\104\000\000\000\000\000\
  18927.   \\003\000\030\000\006\000\105\000\000\000\000\000\
  18928.   \\000\000\000\000\
  18929.   \\000\000\000\000\
  18930.   \\000\000\000\000\
  18931.   \\000\000\000\000\
  18932.   \\000\000\000\000\
  18933.   \\000\000\000\000\
  18934.   \"
  18935.   val numstates = 107
  18936.   val string_to_int = fn(s,index) => (ordof(s,index) + 
  18937.               ordof(s,index+1)*256,index+2)
  18938.       val convert_string_to_row = fn (conv_key,conv_entry) =>
  18939.            fn(s,index) =>
  18940.           let fun f (r,index) =
  18941.               let val (num,index) = string_to_int(s,index)
  18942.                   val (i,index) = string_to_int(s,index)
  18943.               in if num=0 then ((rev r,conv_entry i),index)
  18944.                  else f((conv_key (num-1),conv_entry i)::r,index)
  18945.               end
  18946.           in f(nil,index)
  18947.           end
  18948.        val convert_string_to_row_list = fn conv_funcs => fn s =>
  18949.               let val convert_row =convert_string_to_row conv_funcs
  18950.               fun f(r,index) =
  18951.                 if index < String.length s then
  18952.                   let val (newlist,index) = convert_row (s,index)
  18953.                   in f(newlist::r,index)
  18954.                   end
  18955.                 else rev r
  18956.               in f(nil,0)
  18957.               end
  18958.        val entry_to_action = fn j =>
  18959.              if j=0 then ACCEPT
  18960.              else if j=1 then ERROR
  18961.              else if j >= (numstates+2) then REDUCE (j-numstates-2)
  18962.              else SHIFT (STATE (j-2))
  18963.        val make_goto_table = convert_string_to_row_list(NT,STATE)
  18964.        val make_action_table=convert_string_to_row_list(T,entry_to_action)
  18965.        val gotoT = map (fn (a,b) => a) (make_goto_table gotoT)
  18966.        val actionT = make_action_table actionT
  18967.        in LrTable.mkLrTable {actions=actionT,gotos=gotoT,
  18968.         numStates=numstates,initialState=STATE 0}
  18969.        end
  18970.   end
  18971.   local open Header in
  18972.   type pos = int
  18973.   type arg = unit
  18974.   structure MlyValue = 
  18975.   struct
  18976.   datatype svalue = VOID | ntVOID of unit | T_STR_CONST of  (string)
  18977.    | T_INT_CONST of  (string) | T_ID of  (string)
  18978.    | bnd of  (ParseRes.Trm.pretrm) | appl of  (ParseRes.Trm.pretrm)
  18979.    | term of  (ParseRes.Trm.pretrm)
  18980.    | tplist of  (ParseRes.Typ.pretyp list)
  18981.    | tp of  (ParseRes.Typ.pretyp) | const of  (Id.T)
  18982.    | idlist of  (Id.T list) | id of  (Id.T) | setcmd of  (ParseRes.T)
  18983.    | start of  (ParseRes.T)
  18984.   end
  18985.   type svalue = MlyValue.svalue
  18986.   type result = ParseRes.T
  18987.   end
  18988.   structure EC=
  18989.   struct
  18990.   open LrTable
  18991.   val is_keyword =
  18992.   fn _ => false
  18993.   val preferred_insert =
  18994.   fn (T 1) => true | (T 38) => true | _ => false
  18995.   val preferred_subst =
  18996.   fn  _ => nil
  18997.   val noShift = 
  18998.   fn (T 3) => true | (T 0) => true | _ => false
  18999.   val showTerminal =
  19000.   fn (T 0) => "T_EOF"
  19001.     | (T 1) => "T_DOT"
  19002.     | (T 2) => "T_COLON"
  19003.     | (T 3) => "T_SEMICOLON"
  19004.     | (T 4) => "T_LEQ"
  19005.     | (T 5) => "T_COMMA"
  19006.     | (T 6) => "T_APOST"
  19007.     | (T 7) => "T_EQ"
  19008.     | (T 8) => "T_DOUBLEEQ"
  19009.     | (T 9) => "T_DOLLAR"
  19010.     | (T 10) => "T_AT"
  19011.     | (T 11) => "T_ARROW"
  19012.     | (T 12) => "T_DARROW"
  19013.     | (T 13) => "T_LPAREN"
  19014.     | (T 14) => "T_RPAREN"
  19015.     | (T 15) => "T_LBRACK"
  19016.     | (T 16) => "T_RBRACK"
  19017.     | (T 17) => "T_LANGLE"
  19018.     | (T 18) => "T_RANGLE"
  19019.     | (T 19) => "T_LCURLY"
  19020.     | (T 20) => "T_RCURLY"
  19021.     | (T 21) => "T_INTER"
  19022.     | (T 22) => "T_LAMBDA"
  19023.     | (T 23) => "T_BIGLAMBDA"
  19024.     | (T 24) => "T_ID"
  19025.     | (T 25) => "T_INT_CONST"
  19026.     | (T 26) => "T_STR_CONST"
  19027.     | (T 27) => "T_USE"
  19028.     | (T 28) => "T_TYPE"
  19029.     | (T 29) => "T_SET"
  19030.     | (T 30) => "T_RESET"
  19031.     | (T 31) => "T_DEBUG"
  19032.     | (T 32) => "T_CHECK"
  19033.     | (T 33) => "T_WITH"
  19034.     | (T 34) => "T_ALL"
  19035.     | (T 35) => "T_IN"
  19036.     | (T 36) => "T_NS"
  19037.     | (T 37) => "T_CASE"
  19038.     | (T 38) => "T_OF"
  19039.     | (T 39) => "T_FOR"
  19040.     | (T 40) => "T_OBSERVE"
  19041.     | (T 41) => "T_INSTALL"
  19042.     | (T 42) => "T_SOME"
  19043.     | (T 43) => "T_OPEN"
  19044.     | (T 44) => "T_END"
  19045.     | (T 45) => "T_PACK"
  19046.     | _ => "bogus-term"
  19047.   val errtermvalue=
  19048.   let open Header in
  19049.   fn _ => MlyValue.VOID
  19050.   end
  19051.   val terms = (T 0) :: (T 1) :: (T 2) :: (T 3) :: (T 4) :: (T 5) :: (T 6
  19052.   ) :: (T 7) :: (T 8) :: (T 9) :: (T 10) :: (T 11) :: (T 12) :: (T 13)
  19053.    :: (T 14) :: (T 15) :: (T 16) :: (T 17) :: (T 18) :: (T 19) :: (T 20)
  19054.    :: (T 21) :: (T 22) :: (T 23) :: (T 27) :: (T 28) :: (T 29) :: (T 30)
  19055.    :: (T 31) :: (T 32) :: (T 33) :: (T 34) :: (T 35) :: (T 36) :: (T 37)
  19056.    :: (T 38) :: (T 39) :: (T 40) :: (T 41) :: (T 42) :: (T 43) :: (T 44)
  19057.    :: (T 45) :: nil
  19058.   end
  19059.   structure Actions =
  19060.   struct 
  19061.   exception mlyAction of int
  19062.   val actions = 
  19063.   let open Header
  19064.   in
  19065.   fn (i392,defaultPos,stack,
  19066.       (()):arg) =>
  19067.   case (i392,stack)
  19068.   of (0,(_,(MlyValue.tp (tp2),tp2left,tp2right)) :: (_,(_,T_LEQleft as 
  19069.   T_LEQ1left,T_LEQright as T_LEQ1right)) :: (_,(MlyValue.tp (tp1 as tp),
  19070.   tpleft as tp1left,tpright as tp1right)) :: (_,(_,T_CHECKleft as 
  19071.   T_CHECK1left,T_CHECKright as T_CHECK1right)) :: rest671) =>
  19072.   let val result = 
  19073.   MlyValue.start (((Leq(tp1,tp2))))
  19074.   in (LrTable.NT 0,(result,T_CHECK1left,tp2right),rest671)
  19075.   end
  19076.   | (1,(_,(MlyValue.T_ID (T_ID1 as T_ID),T_IDleft as T_ID1left,
  19077.   T_IDright as T_ID1right)) :: (_,(_,T_USEleft as T_USE1left,
  19078.   T_USEright as T_USE1right)) :: rest671) =>
  19079.   let val result = 
  19080.   MlyValue.start (((Use(T_ID))))
  19081.   in (LrTable.NT 0,(result,T_USE1left,T_ID1right),rest671)
  19082.   end
  19083.   | (2,(_,(MlyValue.tp (tp1 as tp),tpleft as tp1left,tpright as tp1right
  19084.   )) :: (_,(_,T_LEQleft as T_LEQ1left,T_LEQright as T_LEQ1right)) :: 
  19085.   (_,(MlyValue.id (id1 as id),idleft as id1left,idright as id1right
  19086.   )) :: (_,(_,T_TYPEleft as T_TYPE1left,T_TYPEright as T_TYPE1right
  19087.   )) :: rest671) =>
  19088.   let val result = 
  19089.   MlyValue.start (((Type_Assumption(id,tp))))
  19090.   in (LrTable.NT 0,(result,T_TYPE1left,tp1right),rest671)
  19091.   end
  19092.   | (3,(_,(MlyValue.tp (tp1 as tp),tpleft as tp1left,tpright as tp1right
  19093.   )) :: (_,(_,T_LEQleft as T_LEQ1left,T_LEQright as T_LEQ1right)) :: 
  19094.   (_,(MlyValue.id (id1 as id),idleft as id1left,idright as id1right
  19095.   )) :: rest671) =>
  19096.   let val result = 
  19097.   MlyValue.start (((Type_Assumption(id,tp))))
  19098.   in (LrTable.NT 0,(result,id1left,tp1right),rest671)
  19099.   end
  19100.   | (4,(_,(MlyValue.tp (tp1 as tp),tpleft as tp1left,tpright as tp1right
  19101.   )) :: (_,(_,T_DOUBLEEQleft as T_DOUBLEEQ1left,T_DOUBLEEQright as 
  19102.   T_DOUBLEEQ1right)) :: (_,(MlyValue.id (id1 as id),idleft as id1left,
  19103.   idright as id1right)) :: (_,(_,T_TYPEleft as T_TYPE1left,
  19104.   T_TYPEright as T_TYPE1right)) :: rest671) =>
  19105.   let val result = 
  19106.   MlyValue.start (((Type_Abbrev(id,tp))))
  19107.   in (LrTable.NT 0,(result,T_TYPE1left,tp1right),rest671)
  19108.   end
  19109.   | (5,(_,(MlyValue.tp (tp1 as tp),tpleft as tp1left,tpright as tp1right
  19110.   )) :: (_,(_,T_DOUBLEEQleft as T_DOUBLEEQ1left,T_DOUBLEEQright as 
  19111.   T_DOUBLEEQ1right)) :: (_,(MlyValue.id (id1 as id),idleft as id1left,
  19112.   idright as id1right)) :: rest671) =>
  19113.   let val result = 
  19114.   MlyValue.start (((Type_Abbrev(id,tp))))
  19115.   in (LrTable.NT 0,(result,id1left,tp1right),rest671)
  19116.   end
  19117.   | (6,(_,(MlyValue.term (term1 as term),termleft as term1left,
  19118.   termright as term1right)) :: (_,(_,T_EQleft as T_EQ1left,T_EQright as 
  19119.   T_EQ1right)) :: (_,(MlyValue.id (id1 as id),idleft as id1left,
  19120.   idright as id1right)) :: rest671) =>
  19121.   let val result = 
  19122.   MlyValue.start (((Term_Def(id,term))))
  19123.   in (LrTable.NT 0,(result,id1left,term1right),rest671)
  19124.   end
  19125.   | (7,(_,(MlyValue.term (term1 as term),termleft as term1left,
  19126.   termright as term1right)) :: rest671) =>
  19127.   let val result = 
  19128.   MlyValue.start (((Term_Def(Id.intern "it",term))))
  19129.   in (LrTable.NT 0,(result,term1left,term1right),rest671)
  19130.   end
  19131.   | (8,(_,(_,T_EOFleft as T_EOF1left,T_EOFright as T_EOF1right)) :: rest671) =>
  19132.   let val result = 
  19133.   MlyValue.start (((Nothing)))
  19134.   in (LrTable.NT 0,(result,T_EOF1left,T_EOF1right),rest671)
  19135.   end
  19136.   | (9,(_,(MlyValue.setcmd (setcmd1 as setcmd),setcmdleft as setcmd1left
  19137.   ,setcmdright as setcmd1right)) :: rest671) =>
  19138.   let val result = 
  19139.   MlyValue.start (((setcmd)))
  19140.   in (LrTable.NT 0,(result,setcmd1left,setcmd1right),rest671)
  19141.   end
  19142.   | (10,(_,(MlyValue.T_ID (T_ID1 as T_ID),T_IDleft as T_ID1left,
  19143.   T_IDright as T_ID1right)) :: (_,(_,T_SETleft as T_SET1left,
  19144.   T_SETright as T_SET1right)) :: rest671) =>
  19145.   let val result = 
  19146.   MlyValue.setcmd (((Set(T_ID,"true"))))
  19147.   in (LrTable.NT 1,(result,T_SET1left,T_ID1right),rest671)
  19148.   end
  19149.   | (11,(_,(MlyValue.T_ID (T_ID1 as T_ID),T_IDleft as T_ID1left,
  19150.   T_IDright as T_ID1right)) :: (_,(_,T_DEBUGleft as T_DEBUG1left,
  19151.   T_DEBUGright as T_DEBUG1right)) :: rest671) =>
  19152.   let val result = 
  19153.   MlyValue.setcmd (((Set(T_ID,"true"))))
  19154.   in (LrTable.NT 1,(result,T_DEBUG1left,T_ID1right),rest671)
  19155.   end
  19156.   | (12,(_,(MlyValue.T_ID (T_ID1 as T_ID),T_IDleft as T_ID1left,
  19157.   T_IDright as T_ID1right)) :: (_,(_,T_RESETleft as T_RESET1left,
  19158.   T_RESETright as T_RESET1right)) :: rest671) =>
  19159.   let val result = 
  19160.   MlyValue.setcmd (((Set(T_ID,"false"))))
  19161.   in (LrTable.NT 1,(result,T_RESET1left,T_ID1right),rest671)
  19162.   end
  19163.   | (13,(_,(MlyValue.id (id1 as id),idleft as id1left,idright as 
  19164.   id1right)) :: rest671) =>
  19165.   let val result = 
  19166.   MlyValue.tp (((PRETVAR(id))))
  19167.   in (LrTable.NT 5,(result,id1left,id1right),rest671)
  19168.   end
  19169.   | (14,(_,(MlyValue.tp (tp2),tp2left,tp2right)) :: (_,(_,
  19170.   T_ARROWleft as T_ARROW1left,T_ARROWright as T_ARROW1right)) :: (_,(
  19171.   MlyValue.tp (tp1 as tp),tpleft as tp1left,tpright as tp1right)) :: rest671) =>
  19172.   let val result = 
  19173.   MlyValue.tp (((PREARROW(tp1,tp2))))
  19174.   in (LrTable.NT 5,(result,tp1left,tp2right),rest671)
  19175.   end
  19176.   | (15,(_,(MlyValue.tp (tp2),tp2left,tp2right)) :: (_,(_,
  19177.   T_INTERleft as T_INTER1left,T_INTERright as T_INTER1right)) :: (_,(
  19178.   MlyValue.tp (tp1 as tp),tpleft as tp1left,tpright as tp1right)) :: rest671) =>
  19179.   let val result = 
  19180.   MlyValue.tp (((PREMEET([tp1,tp2]))))
  19181.   in (LrTable.NT 5,(result,tp1left,tp2right),rest671)
  19182.   end
  19183.   | (16,(_,(_,T_RBRACKleft as T_RBRACK1left,T_RBRACKright as 
  19184.   T_RBRACK1right)) :: (_,(MlyValue.tplist (tplist1 as tplist),
  19185.   tplistleft as tplist1left,tplistright as tplist1right)) :: (_,(_,
  19186.   T_LBRACKleft as T_LBRACK1left,T_LBRACKright as T_LBRACK1right)) :: 
  19187.   (_,(_,T_INTERleft as T_INTER1left,T_INTERright as T_INTER1right)) :: rest671) =>
  19188.   let val result = 
  19189.   MlyValue.tp (((PREMEET(tplist))))
  19190.   in (LrTable.NT 5,(result,T_INTER1left,T_RBRACK1right),rest671)
  19191.   end
  19192.   | (17,(_,(_,T_NSleft as T_NS1left,T_NSright as T_NS1right)) :: rest671) =>
  19193.   let val result = 
  19194.   MlyValue.tp (((PREMEET([]))))
  19195.   in (LrTable.NT 5,(result,T_NS1left,T_NS1right),rest671)
  19196.   end
  19197.   | (18,(_,(_,T_RPARENleft as T_RPAREN1left,T_RPARENright as 
  19198.   T_RPAREN1right)) :: (_,(MlyValue.tp (tp1 as tp),tpleft as tp1left,
  19199.   tpright as tp1right)) :: (_,(_,T_LPARENleft as T_LPAREN1left,
  19200.   T_LPARENright as T_LPAREN1right)) :: rest671) =>
  19201.   let val result = 
  19202.   MlyValue.tp (((tp)))
  19203.   in (LrTable.NT 5,(result,T_LPAREN1left,T_RPAREN1right),rest671)
  19204.   end
  19205.   | (19,(_,(MlyValue.tp (tp1 as tp),tpleft as tp1left,tpright as 
  19206.   tp1right)) :: (_,(_,T_DOTleft as T_DOT1left,T_DOTright as T_DOT1right
  19207.   )) :: (_,(MlyValue.id (id1 as id),idleft as id1left,idright as 
  19208.   id1right)) :: (_,(_,T_ALLleft as T_ALL1left,T_ALLright as T_ALL1right
  19209.   )) :: rest671) =>
  19210.   let val result = 
  19211.   MlyValue.tp (((PREALL(id, PREMEET[], tp))))
  19212.   in (LrTable.NT 5,(result,T_ALL1left,tp1right),rest671)
  19213.   end
  19214.   | (20,(_,(MlyValue.tp (tp2),tp2left,tp2right)) :: (_,(_,T_DOTleft as 
  19215.   T_DOT1left,T_DOTright as T_DOT1right)) :: (_,(MlyValue.tp (tp1 as tp),
  19216.   tpleft as tp1left,tpright as tp1right)) :: (_,(_,T_LEQleft as 
  19217.   T_LEQ1left,T_LEQright as T_LEQ1right)) :: (_,(MlyValue.id (id1 as id),
  19218.   idleft as id1left,idright as id1right)) :: (_,(_,T_ALLleft as 
  19219.   T_ALL1left,T_ALLright as T_ALL1right)) :: rest671) =>
  19220.   let val result = 
  19221.   MlyValue.tp (((PREALL(id, tp1, tp2))))
  19222.   in (LrTable.NT 5,(result,T_ALL1left,tp2right),rest671)
  19223.   end
  19224.   | (21,(_,(MlyValue.tp (tp1 as tp),tpleft as tp1left,tpright as 
  19225.   tp1right)) :: (_,(_,T_DOTleft as T_DOT1left,T_DOTright as T_DOT1right
  19226.   )) :: (_,(MlyValue.id (id1 as id),idleft as id1left,idright as 
  19227.   id1right)) :: (_,(_,T_SOMEleft as T_SOME1left,T_SOMEright as 
  19228.   T_SOME1right)) :: rest671) =>
  19229.   let val result = 
  19230.   MlyValue.tp (((
  19231.   let val b = Id.new()
  19232.                val bv = PRETVAR(b)
  19233.                val idv = PRETVAR(id)
  19234.            in PREALL(b,PREMEET[], 
  19235.                  PREARROW(PREALL(id, PREMEET[], 
  19236.                       PREARROW(tp, bv)),
  19237.                    bv))
  19238.            end
  19239.   )))
  19240.   in (LrTable.NT 5,(result,T_SOME1left,tp1right),rest671)
  19241.   end
  19242.   | (22,(_,(MlyValue.tp (tp2),tp2left,tp2right)) :: (_,(_,T_DOTleft as 
  19243.   T_DOT1left,T_DOTright as T_DOT1right)) :: (_,(MlyValue.tp (tp1 as tp),
  19244.   tpleft as tp1left,tpright as tp1right)) :: (_,(_,T_LEQleft as 
  19245.   T_LEQ1left,T_LEQright as T_LEQ1right)) :: (_,(MlyValue.id (id1 as id),
  19246.   idleft as id1left,idright as id1right)) :: (_,(_,T_SOMEleft as 
  19247.   T_SOME1left,T_SOMEright as T_SOME1right)) :: rest671) =>
  19248.   let val result = 
  19249.   MlyValue.tp (((
  19250.   let val b = Id.new()
  19251.                val bv = PRETVAR(b)
  19252.                val idv = PRETVAR(id)
  19253.            in PREALL(b,PREMEET[], 
  19254.                  PREARROW(PREALL(id, tp1, 
  19255.                       PREARROW(tp2, bv)),
  19256.                    bv))
  19257.            end
  19258.   )))
  19259.   in (LrTable.NT 5,(result,T_SOME1left,tp2right),rest671)
  19260.   end
  19261.   | (23,(_,(MlyValue.tp (tp1 as tp),tpleft as tp1left,tpright as 
  19262.   tp1right)) :: rest671) =>
  19263.   let val result = 
  19264.   MlyValue.tplist ((([tp])))
  19265.   in (LrTable.NT 6,(result,tp1left,tp1right),rest671)
  19266.   end
  19267.   | (24,(_,(MlyValue.tplist (tplist1 as tplist),tplistleft as 
  19268.   tplist1left,tplistright as tplist1right)) :: (_,(_,T_COMMAleft as 
  19269.   T_COMMA1left,T_COMMAright as T_COMMA1right)) :: (_,(MlyValue.tp (tp1
  19270.    as tp),tpleft as tp1left,tpright as tp1right)) :: rest671) =>
  19271.   let val result = 
  19272.   MlyValue.tplist (((tp::tplist)))
  19273.   in (LrTable.NT 6,(result,tp1left,tplist1right),rest671)
  19274.   end
  19275.   | (25,(_,(MlyValue.id (id1 as id),idleft as id1left,idright as 
  19276.   id1right)) :: rest671) =>
  19277.   let val result = 
  19278.   MlyValue.idlist ((([id])))
  19279.   in (LrTable.NT 3,(result,id1left,id1right),rest671)
  19280.   end
  19281.   | (26,(_,(MlyValue.idlist (idlist1 as idlist),idlistleft as 
  19282.   idlist1left,idlistright as idlist1right)) :: (_,(_,T_COMMAleft as 
  19283.   T_COMMA1left,T_COMMAright as T_COMMA1right)) :: (_,(MlyValue.id (id1
  19284.    as id),idleft as id1left,idright as id1right)) :: rest671) =>
  19285.   let val result = 
  19286.   MlyValue.idlist (((id::idlist)))
  19287.   in (LrTable.NT 3,(result,id1left,idlist1right),rest671)
  19288.   end
  19289.   | (27,(_,(MlyValue.T_ID (T_ID1 as T_ID),T_IDleft as T_ID1left,
  19290.   T_IDright as T_ID1right)) :: rest671) =>
  19291.   let val result = 
  19292.   MlyValue.id (((Id.intern T_ID)))
  19293.   in (LrTable.NT 2,(result,T_ID1left,T_ID1right),rest671)
  19294.   end
  19295.   | (28,(_,(MlyValue.id (id1 as id),idleft as id1left,idright as 
  19296.   id1right)) :: rest671) =>
  19297.   let val result = 
  19298.   MlyValue.const (((id)))
  19299.   in (LrTable.NT 4,(result,id1left,id1right),rest671)
  19300.   end
  19301.   | (29,(_,(MlyValue.T_INT_CONST (T_INT_CONST1 as T_INT_CONST),
  19302.   T_INT_CONSTleft as T_INT_CONST1left,T_INT_CONSTright as 
  19303.   T_INT_CONST1right)) :: rest671) =>
  19304.   let val result = 
  19305.   MlyValue.const (((Id.intern T_INT_CONST)))
  19306.   in (LrTable.NT 4,(result,T_INT_CONST1left,T_INT_CONST1right),rest671)
  19307.   end
  19308.   | (30,(_,(MlyValue.T_STR_CONST (T_STR_CONST1 as T_STR_CONST),
  19309.   T_STR_CONSTleft as T_STR_CONST1left,T_STR_CONSTright as 
  19310.   T_STR_CONST1right)) :: rest671) =>
  19311.   let val result = 
  19312.   MlyValue.const (((Id.intern T_STR_CONST)))
  19313.   in (LrTable.NT 4,(result,T_STR_CONST1left,T_STR_CONST1right),rest671)
  19314.   end
  19315.   | (31,(_,(MlyValue.appl (appl1 as appl),applleft as appl1left,
  19316.   applright as appl1right)) :: rest671) =>
  19317.   let val result = 
  19318.   MlyValue.term (((appl)))
  19319.   in (LrTable.NT 7,(result,appl1left,appl1right),rest671)
  19320.   end
  19321.   | (32,(_,(MlyValue.bnd (bnd1 as bnd),bndleft as bnd1left,bndright as 
  19322.   bnd1right)) :: rest671) =>
  19323.   let val result = 
  19324.   MlyValue.term (((bnd)))
  19325.   in (LrTable.NT 7,(result,bnd1left,bnd1right),rest671)
  19326.   end
  19327.   | (33,(_,(MlyValue.term (term1 as term),termleft as term1left,
  19328.   termright as term1right)) :: (_,(_,T_DOTleft as T_DOT1left,
  19329.   T_DOTright as T_DOT1right)) :: (_,(MlyValue.tplist (tplist1 as tplist)
  19330.   ,tplistleft as tplist1left,tplistright as tplist1right)) :: (_,(_,
  19331.   T_COLONleft as T_COLON1left,T_COLONright as T_COLON1right)) :: (_,(
  19332.   MlyValue.id (id1 as id),idleft as id1left,idright as id1right)) :: 
  19333.   (_,(_,T_LAMBDAleft as T_LAMBDA1left,T_LAMBDAright as T_LAMBDA1right
  19334.   )) :: rest671) =>
  19335.   let val result = 
  19336.   MlyValue.bnd (((
  19337.   case tplist of 
  19338.                           [t] => PREABS(id,t,term)
  19339.                         | ts  => 
  19340.                         let val a = Id.new_from id
  19341.                         in PREFOR(a,ts,
  19342.                              PREABS(id,PRETVAR(a),term))
  19343.                         end
  19344.   )))
  19345.   in (LrTable.NT 9,(result,T_LAMBDA1left,term1right),rest671)
  19346.   end
  19347.   | (34,(_,(MlyValue.term (term1 as term),termleft as term1left,
  19348.   termright as term1right)) :: (_,(_,T_DOTleft as T_DOT1left,
  19349.   T_DOTright as T_DOT1right)) :: (_,(MlyValue.id (id1 as id),idleft as 
  19350.   id1left,idright as id1right)) :: (_,(_,T_BIGLAMBDAleft as 
  19351.   T_BIGLAMBDA1left,T_BIGLAMBDAright as T_BIGLAMBDA1right)) :: rest671) =>
  19352.   let val result = 
  19353.   MlyValue.bnd (((PRETABS(id,PREMEET[],term))))
  19354.   in (LrTable.NT 9,(result,T_BIGLAMBDA1left,term1right),rest671)
  19355.   end
  19356.   | (35,(_,(MlyValue.term (term1 as term),termleft as term1left,
  19357.   termright as term1right)) :: (_,(_,T_DOTleft as T_DOT1left,
  19358.   T_DOTright as T_DOT1right)) :: (_,(MlyValue.tp (tp1 as tp),tpleft as 
  19359.   tp1left,tpright as tp1right)) :: (_,(_,T_LEQleft as T_LEQ1left,
  19360.   T_LEQright as T_LEQ1right)) :: (_,(MlyValue.id (id1 as id),idleft as 
  19361.   id1left,idright as id1right)) :: (_,(_,T_BIGLAMBDAleft as 
  19362.   T_BIGLAMBDA1left,T_BIGLAMBDAright as T_BIGLAMBDA1right)) :: rest671) =>
  19363.   let val result = 
  19364.   MlyValue.bnd (((PRETABS(id,tp,term))))
  19365.   in (LrTable.NT 9,(result,T_BIGLAMBDA1left,term1right),rest671)
  19366.   end
  19367.   | (36,(_,(MlyValue.term (term1 as term),termleft as term1left,
  19368.   termright as term1right)) :: (_,(_,T_DOTleft as T_DOT1left,
  19369.   T_DOTright as T_DOT1right)) :: (_,(MlyValue.tplist (tplist1 as tplist)
  19370.   ,tplistleft as tplist1left,tplistright as tplist1right)) :: (_,(_,
  19371.   T_INleft as T_IN1left,T_INright as T_IN1right)) :: (_,(MlyValue.idlist
  19372.    (idlist1 as idlist),idlistleft as idlist1left,idlistright as 
  19373.   idlist1right)) :: (_,(_,T_BIGLAMBDAleft as T_BIGLAMBDA1left,
  19374.   T_BIGLAMBDAright as T_BIGLAMBDA1right)) :: rest671) =>
  19375.   let val result = 
  19376.   MlyValue.bnd (((
  19377.   let fun f [] = term
  19378.                          | f (v::vs) =
  19379.                               PREFOR(v, tplist, f vs)
  19380.                        in f idlist end
  19381.   )))
  19382.   in (LrTable.NT 9,(result,T_BIGLAMBDA1left,term1right),rest671)
  19383.   end
  19384.   | (37,(_,(MlyValue.term (term1 as term),termleft as term1left,
  19385.   termright as term1right)) :: (_,(_,T_DOTleft as T_DOT1left,
  19386.   T_DOTright as T_DOT1right)) :: (_,(MlyValue.tplist (tplist1 as tplist)
  19387.   ,tplistleft as tplist1left,tplistright as tplist1right)) :: (_,(_,
  19388.   T_INleft as T_IN1left,T_INright as T_IN1right)) :: (_,(MlyValue.idlist
  19389.    (idlist1 as idlist),idlistleft as idlist1left,idlistright as 
  19390.   idlist1right)) :: (_,(_,T_FORleft as T_FOR1left,T_FORright as 
  19391.   T_FOR1right)) :: rest671) =>
  19392.   let val result = 
  19393.   MlyValue.bnd (((
  19394.   let fun f [] = term
  19395.                          | f (v::vs) =
  19396.                               PREFOR(v, tplist, f vs)
  19397.                        in f idlist end
  19398.   )))
  19399.   in (LrTable.NT 9,(result,T_FOR1left,term1right),rest671)
  19400.   end
  19401.   | (38,(_,(MlyValue.const (const1 as const),constleft as const1left,
  19402.   constright as const1right)) :: rest671) =>
  19403.   let val result = 
  19404.   MlyValue.appl (((PREVAR(const))))
  19405.   in (LrTable.NT 8,(result,const1left,const1right),rest671)
  19406.   end
  19407.   | (39,(_,(_,T_RPARENleft as T_RPAREN1left,T_RPARENright as 
  19408.   T_RPAREN1right)) :: (_,(MlyValue.term (term1 as term),termleft as 
  19409.   term1left,termright as term1right)) :: (_,(_,T_LPARENleft as 
  19410.   T_LPAREN1left,T_LPARENright as T_LPAREN1right)) :: rest671) =>
  19411.   let val result = 
  19412.   MlyValue.appl (((term)))
  19413.   in (LrTable.NT 8,(result,T_LPAREN1left,T_RPAREN1right),rest671)
  19414.   end
  19415.   | (40,(_,(MlyValue.id (id1 as id),idleft as id1left,idright as 
  19416.   id1right)) :: (_,(MlyValue.appl (appl1 as appl),applleft as appl1left,
  19417.   applright as appl1right)) :: rest671) =>
  19418.   let val result = 
  19419.   MlyValue.appl (((PREAPP(appl,PREVAR(id)))))
  19420.   in (LrTable.NT 8,(result,appl1left,id1right),rest671)
  19421.   end
  19422.   | (41,(_,(_,T_RPARENleft as T_RPAREN1left,T_RPARENright as 
  19423.   T_RPAREN1right)) :: (_,(MlyValue.term (term1 as term),termleft as 
  19424.   term1left,termright as term1right)) :: (_,(_,T_LPARENleft as 
  19425.   T_LPAREN1left,T_LPARENright as T_LPAREN1right)) :: (_,(MlyValue.appl (
  19426.   appl1 as appl),applleft as appl1left,applright as appl1right)) :: rest671) =>
  19427.   let val result = 
  19428.   MlyValue.appl (((PREAPP(appl,term))))
  19429.   in (LrTable.NT 8,(result,appl1left,T_RPAREN1right),rest671)
  19430.   end
  19431.   | (42,(_,(_,T_RBRACKleft as T_RBRACK1left,T_RBRACKright as 
  19432.   T_RBRACK1right)) :: (_,(MlyValue.tp (tp1 as tp),tpleft as tp1left,
  19433.   tpright as tp1right)) :: (_,(_,T_LBRACKleft as T_LBRACK1left,
  19434.   T_LBRACKright as T_LBRACK1right)) :: (_,(MlyValue.appl (appl1 as appl)
  19435.   ,applleft as appl1left,applright as appl1right)) :: rest671) =>
  19436.   let val result = 
  19437.   MlyValue.appl (((PRETAPP(appl,tp))))
  19438.   in (LrTable.NT 8,(result,appl1left,T_RBRACK1right),rest671)
  19439.   end
  19440.   | _ => raise (mlyAction i392)
  19441.   end
  19442.   val void = MlyValue.VOID
  19443.   val extract = fn a => (fn MlyValue.start x => x
  19444.   | _ => let exception ParseInternal
  19445.       in raise ParseInternal end) a 
  19446.   end
  19447.   end
  19448.   structure Tokens : FMEET_TOKENS =
  19449.   struct
  19450.   type svalue = ParserData.svalue
  19451.   type ('a,'b) token = ('a,'b) Token.token
  19452.   fun T_EOF (p1,p2) = Token.TOKEN (ParserData.LrTable.T 0,(
  19453.   ParserData.MlyValue.VOID,p1,p2))
  19454.   fun T_DOT (p1,p2) = Token.TOKEN (ParserData.LrTable.T 1,(
  19455.   ParserData.MlyValue.VOID,p1,p2))
  19456.   fun T_COLON (p1,p2) = Token.TOKEN (ParserData.LrTable.T 2,(
  19457.   ParserData.MlyValue.VOID,p1,p2))
  19458.   fun T_SEMICOLON (p1,p2) = Token.TOKEN (ParserData.LrTable.T 3,(
  19459.   ParserData.MlyValue.VOID,p1,p2))
  19460.   fun T_LEQ (p1,p2) = Token.TOKEN (ParserData.LrTable.T 4,(
  19461.   ParserData.MlyValue.VOID,p1,p2))
  19462.   fun T_COMMA (p1,p2) = Token.TOKEN (ParserData.LrTable.T 5,(
  19463.   ParserData.MlyValue.VOID,p1,p2))
  19464.   fun T_APOST (p1,p2) = Token.TOKEN (ParserData.LrTable.T 6,(
  19465.   ParserData.MlyValue.VOID,p1,p2))
  19466.   fun T_EQ (p1,p2) = Token.TOKEN (ParserData.LrTable.T 7,(
  19467.   ParserData.MlyValue.VOID,p1,p2))
  19468.   fun T_DOUBLEEQ (p1,p2) = Token.TOKEN (ParserData.LrTable.T 8,(
  19469.   ParserData.MlyValue.VOID,p1,p2))
  19470.   fun T_DOLLAR (p1,p2) = Token.TOKEN (ParserData.LrTable.T 9,(
  19471.   ParserData.MlyValue.VOID,p1,p2))
  19472.   fun T_AT (p1,p2) = Token.TOKEN (ParserData.LrTable.T 10,(
  19473.   ParserData.MlyValue.VOID,p1,p2))
  19474.   fun T_ARROW (p1,p2) = Token.TOKEN (ParserData.LrTable.T 11,(
  19475.   ParserData.MlyValue.VOID,p1,p2))
  19476.   fun T_DARROW (p1,p2) = Token.TOKEN (ParserData.LrTable.T 12,(
  19477.   ParserData.MlyValue.VOID,p1,p2))
  19478.   fun T_LPAREN (p1,p2) = Token.TOKEN (ParserData.LrTable.T 13,(
  19479.   ParserData.MlyValue.VOID,p1,p2))
  19480.   fun T_RPAREN (p1,p2) = Token.TOKEN (ParserData.LrTable.T 14,(
  19481.   ParserData.MlyValue.VOID,p1,p2))
  19482.   fun T_LBRACK (p1,p2) = Token.TOKEN (ParserData.LrTable.T 15,(
  19483.   ParserData.MlyValue.VOID,p1,p2))
  19484.   fun T_RBRACK (p1,p2) = Token.TOKEN (ParserData.LrTable.T 16,(
  19485.   ParserData.MlyValue.VOID,p1,p2))
  19486.   fun T_LANGLE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 17,(
  19487.   ParserData.MlyValue.VOID,p1,p2))
  19488.   fun T_RANGLE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 18,(
  19489.   ParserData.MlyValue.VOID,p1,p2))
  19490.   fun T_LCURLY (p1,p2) = Token.TOKEN (ParserData.LrTable.T 19,(
  19491.   ParserData.MlyValue.VOID,p1,p2))
  19492.   fun T_RCURLY (p1,p2) = Token.TOKEN (ParserData.LrTable.T 20,(
  19493.   ParserData.MlyValue.VOID,p1,p2))
  19494.   fun T_INTER (p1,p2) = Token.TOKEN (ParserData.LrTable.T 21,(
  19495.   ParserData.MlyValue.VOID,p1,p2))
  19496.   fun T_LAMBDA (p1,p2) = Token.TOKEN (ParserData.LrTable.T 22,(
  19497.   ParserData.MlyValue.VOID,p1,p2))
  19498.   fun T_BIGLAMBDA (p1,p2) = Token.TOKEN (ParserData.LrTable.T 23,(
  19499.   ParserData.MlyValue.VOID,p1,p2))
  19500.   fun T_ID (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 24,(
  19501.   ParserData.MlyValue.T_ID i,p1,p2))
  19502.   fun T_INT_CONST (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 25,(
  19503.   ParserData.MlyValue.T_INT_CONST i,p1,p2))
  19504.   fun T_STR_CONST (i,p1,p2) = Token.TOKEN (ParserData.LrTable.T 26,(
  19505.   ParserData.MlyValue.T_STR_CONST i,p1,p2))
  19506.   fun T_USE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 27,(
  19507.   ParserData.MlyValue.VOID,p1,p2))
  19508.   fun T_TYPE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 28,(
  19509.   ParserData.MlyValue.VOID,p1,p2))
  19510.   fun T_SET (p1,p2) = Token.TOKEN (ParserData.LrTable.T 29,(
  19511.   ParserData.MlyValue.VOID,p1,p2))
  19512.   fun T_RESET (p1,p2) = Token.TOKEN (ParserData.LrTable.T 30,(
  19513.   ParserData.MlyValue.VOID,p1,p2))
  19514.   fun T_DEBUG (p1,p2) = Token.TOKEN (ParserData.LrTable.T 31,(
  19515.   ParserData.MlyValue.VOID,p1,p2))
  19516.   fun T_CHECK (p1,p2) = Token.TOKEN (ParserData.LrTable.T 32,(
  19517.   ParserData.MlyValue.VOID,p1,p2))
  19518.   fun T_WITH (p1,p2) = Token.TOKEN (ParserData.LrTable.T 33,(
  19519.   ParserData.MlyValue.VOID,p1,p2))
  19520.   fun T_ALL (p1,p2) = Token.TOKEN (ParserData.LrTable.T 34,(
  19521.   ParserData.MlyValue.VOID,p1,p2))
  19522.   fun T_IN (p1,p2) = Token.TOKEN (ParserData.LrTable.T 35,(
  19523.   ParserData.MlyValue.VOID,p1,p2))
  19524.   fun T_NS (p1,p2) = Token.TOKEN (ParserData.LrTable.T 36,(
  19525.   ParserData.MlyValue.VOID,p1,p2))
  19526.   fun T_CASE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 37,(
  19527.   ParserData.MlyValue.VOID,p1,p2))
  19528.   fun T_OF (p1,p2) = Token.TOKEN (ParserData.LrTable.T 38,(
  19529.   ParserData.MlyValue.VOID,p1,p2))
  19530.   fun T_FOR (p1,p2) = Token.TOKEN (ParserData.LrTable.T 39,(
  19531.   ParserData.MlyValue.VOID,p1,p2))
  19532.   fun T_OBSERVE (p1,p2) = Token.TOKEN (ParserData.LrTable.T 40,(
  19533.   ParserData.MlyValue.VOID,p1,p2))
  19534.   fun T_INSTALL (p1,p2) = Token.TOKEN (ParserData.LrTable.T 41,(
  19535.   ParserData.MlyValue.VOID,p1,p2))
  19536.   fun T_SOME (p1,p2) = Token.TOKEN (ParserData.LrTable.T 42,(
  19537.   ParserData.MlyValue.VOID,p1,p2))
  19538.   fun T_OPEN (p1,p2) = Token.TOKEN (ParserData.LrTable.T 43,(
  19539.   ParserData.MlyValue.VOID,p1,p2))
  19540.   fun T_END (p1,p2) = Token.TOKEN (ParserData.LrTable.T 44,(
  19541.   ParserData.MlyValue.VOID,p1,p2))
  19542.   fun T_PACK (p1,p2) = Token.TOKEN (ParserData.LrTable.T 45,(
  19543.   ParserData.MlyValue.VOID,p1,p2))
  19544.   end
  19545.   end
  19546.   signature FILEUTILS = sig
  19547.  
  19548.   val open_fmeet_file: string -> (instream * string)
  19549.  
  19550.   end
  19551.   functor Main(
  19552.        structure Globals: GLOBALS
  19553.        structure Typ: TYP
  19554.        structure Trm: TRM
  19555.        structure FileUtils: FILEUTILS
  19556.        structure Parse: PARSE
  19557.        structure Leq: LEQ
  19558.        structure Synth: SYNTH
  19559.        sharing Typ.Globals = Globals
  19560.            and Parse.ParseRes.Typ = Typ
  19561.            and Parse.ParseRes.Trm = Trm
  19562.            and Leq.Typ = Typ
  19563.            and Trm.Typ = Typ
  19564.            and Synth.Trm = Trm
  19565.            and Synth.Leq = Leq
  19566.        val buildtime : string
  19567.       ) = struct
  19568.  
  19569.   open Globals;
  19570.   open Parse.ParseRes;
  19571.  
  19572.   val global_tenv = ref(Typ.empty_tenv)
  19573.  
  19574.   exception NotABoolean
  19575.  
  19576.   fun string_to_bool "true" = true
  19577.     | string_to_bool "True" = true
  19578.     | string_to_bool "TRUE" = true
  19579.     | string_to_bool "t" = true
  19580.     | string_to_bool "T" = true
  19581.     | string_to_bool "yes" = true
  19582.     | string_to_bool "Yes" = true
  19583.     | string_to_bool "YES" = true
  19584.     | string_to_bool "false" = false
  19585.     | string_to_bool "False" = false
  19586.     | string_to_bool "FALSE" = false
  19587.     | string_to_bool "f" = false
  19588.     | string_to_bool "F" = false
  19589.     | string_to_bool "no" = false
  19590.     | string_to_bool "No" = false
  19591.     | string_to_bool "NO" = false
  19592.     | string_to_bool _ = raise NotABoolean
  19593.  
  19594.   fun rep_loop done parser error =
  19595.     while (not (done())) do
  19596.       (case parser() of
  19597.        Use(f) => 
  19598.          rep_loop_on_file f
  19599.      | Type_Assumption(i,pt) =>
  19600.          let val t = Typ.debruijnify (!global_tenv) pt
  19601.          in 
  19602.         write (Id.tostr i);
  19603.         write " <= ";
  19604.         Typ.prt (stdpp()) (!global_tenv) t;
  19605.         write "\n";
  19606.         global_tenv := Typ.push_bound (!global_tenv) i t
  19607.          end
  19608.      | Type_Abbrev(i,pt) =>
  19609.          let val t = Typ.debruijnify (!global_tenv) pt
  19610.          val _ = global_tenv := Typ.push_abbrev (!global_tenv) i t
  19611.          in 
  19612.         write (Id.tostr i);
  19613.         write " == ";
  19614.         Typ.prt (stdpp()) (!global_tenv) t;
  19615.         write "\n"
  19616.          end
  19617.      | Term_Def(i,ptrm) =>
  19618.          let val trm = Trm.debruijnify (!global_tenv) ptrm
  19619.          val typ = Synth.synth (!global_tenv) trm
  19620.          in 
  19621.         write (Id.tostr i);
  19622.         write " = ";
  19623.         Pp.setb (stdpp());
  19624.         Trm.prt (stdpp()) (!global_tenv) trm;
  19625.         Pp.break (stdpp()) true ~3;
  19626.         write " : ";
  19627.         Typ.prt (stdpp()) (!global_tenv) typ;
  19628.         Pp.break (stdpp()) true ~3;
  19629.         (* write " in ";
  19630.            Typ.prt_tenv (stdpp()) (Typ.pop (!global_tenv)); *)
  19631.         Pp.endb (stdpp());
  19632.         write "\n";
  19633.         global_tenv := Typ.push_binding (!global_tenv) i typ
  19634.          end
  19635.      | Leq(pt1,pt2) =>
  19636.          let val t1 = Typ.debruijnify (!global_tenv) pt1
  19637.          val t2 = Typ.debruijnify (!global_tenv) pt2
  19638.          in 
  19639.         if Leq.leq (!global_tenv) t1 t2 
  19640.           then write "Yes\n"
  19641.           else write "No\n"
  19642.         end
  19643.      | Nothing => 
  19644.          ()
  19645.      | Set(name,v) => 
  19646.          (set_flag name (string_to_bool v))
  19647.      | _ => 
  19648.        write "Unimplemented ParseResult!\n"
  19649.       )
  19650.       handle 
  19651.     Typ.WrongKindOfId(te,i,which) => 
  19652.         (write ("Wrong kind of identifier: "^ (makestring i) ^" ("
  19653.             ^ which ^ " expected)\nin "); 
  19654.          Typ.prt_tenv (stdpp()) te;
  19655.          error())
  19656.       | unknown => 
  19657.         (write ("Exception: "^(System.exn_name unknown)^"\n"); 
  19658.          error())
  19659.  
  19660.   and rep_loop_on_file fname =
  19661.        let val (dev,real_name) = FileUtils.open_fmeet_file fname
  19662.            val quit = ref false
  19663.            fun parser() = Parse.stream_parse dev
  19664.            fun done() = (!quit) orelse (end_of_stream dev)
  19665.            fun error() = (quit := true);
  19666.        in 
  19667.           write ("Reading from \"" ^ real_name ^ "\"...\n\n");
  19668.           (rep_loop done parser error;
  19669.            write ("\nClosing " ^ real_name ^ "\n");
  19670.            close_in dev)
  19671.           handle Io(s) => write ("IO error on " ^ fname ^ ": " ^ s ^ "\n")
  19672.        end
  19673.  
  19674.   fun top() = 
  19675.     let fun top_done () = (print "> "; flush_out std_out; end_of_stream(std_in))
  19676.     fun top_error () = ()
  19677.     in
  19678.       write ("Welcome to FMEET (" ^ buildtime ^ ")...\n\n");
  19679.       rep_loop top_done Parse.top_parse top_error;
  19680.       write "\n"
  19681.     end
  19682.  
  19683.   val read_from_file = ref "";
  19684.  
  19685.   fun parse_switches ("-i"::s::rest) 
  19686.       = (read_from_file := s;
  19687.          parse_switches rest)
  19688.     | parse_switches (s::rest) 
  19689.       = (read_from_file := s;
  19690.          parse_switches rest)
  19691.     | parse_switches ([]) 
  19692.       = ()
  19693.  
  19694.   fun rep_command_line(argv,env) = 
  19695.     (parse_switches (tl argv);
  19696.      if (!read_from_file) = ""
  19697.     then top()
  19698.     else rep_loop_on_file (!read_from_file)
  19699.      )
  19700.  
  19701.   fun process_file s = rep_command_line (["",s^".fm"],nil);
  19702.  
  19703.   end
  19704.  
  19705.  
  19706.   functor WrMgt(
  19707.           structure Wr: WR
  19708.           structure Pp: PP
  19709.           sharing Pp.Wr = Wr
  19710.           ) : WRMGT 
  19711.           = struct
  19712.  
  19713.   structure Wr = Wr;
  19714.   structure Pp = Pp;
  19715.  
  19716.   val current_underlying_wr = ref(Wr.to_stdout());
  19717.   val current_pp = ref(Pp.pp_from_wr (!current_underlying_wr));
  19718.   val current_wr = ref(Pp.wr_from_pp (!current_pp));
  19719.  
  19720.   fun stdpp() = !current_pp;
  19721.  
  19722.   fun get_current_wr() = !current_wr;
  19723.  
  19724.   fun set_current_wr wr =
  19725.     (current_underlying_wr := wr;
  19726.      current_pp := Pp.pp_from_wr (!current_underlying_wr);
  19727.      current_wr := Pp.wr_from_pp (!current_pp))
  19728.  
  19729.   fun write s = Pp.pwrite (!current_pp) s;
  19730.  
  19731.   end
  19732.   functor Id (structure SymTab: HASH
  19733.           structure InvSymTab: TABLE
  19734.           sharing type SymTab.elem = string
  19735.           and type InvSymTab.key = int
  19736.          ) : ID =
  19737.   struct
  19738.  
  19739.   val symtab = ref SymTab.empty;
  19740.   val invsymtab = ref (InvSymTab.empty: string InvSymTab.table);
  19741.  
  19742.   val DEBUG = ref false;
  19743.  
  19744.   type T = int
  19745.  
  19746.   exception CantHappen
  19747.  
  19748.   fun intern (s:string) = 
  19749.     let val _ = if not (SymTab.exists(s,!symtab))
  19750.                then symtab := SymTab.add(s, (!symtab))
  19751.                else ()
  19752.         val i_opt = SymTab.find (s, (!symtab))
  19753.     in
  19754.        case i_opt of
  19755.          NONE => raise CantHappen
  19756.        | SOME(i) => 
  19757.            (invsymtab := InvSymTab.insert((i,s), (!invsymtab));
  19758.         i)
  19759.     end
  19760.  
  19761.   fun hashcode i = i
  19762.  
  19763.   exception UnknownId
  19764.  
  19765.   fun tostr (i:T) : string = 
  19766.       let val s_opt = InvSymTab.find (i, (!invsymtab))
  19767.       in
  19768.           case s_opt of
  19769.          NONE => raise UnknownId
  19770.            | SOME(s) => s
  19771.       end
  19772.  
  19773.   val newvarcount = ref 0;
  19774.  
  19775.   fun reset_new_counter() = (newvarcount := 0)
  19776.  
  19777.   fun new_from i =
  19778.       let val _ = newvarcount := !newvarcount + 1
  19779.       val name = (tostr i) ^ "_" ^ (makestring (!newvarcount))
  19780.       in 
  19781.      if SymTab.exists(name,!symtab)
  19782.         then new_from i
  19783.         else intern name
  19784.       end
  19785.  
  19786.   val id_x = intern "x"
  19787.  
  19788.   fun new() = new_from id_x
  19789.  
  19790.   fun == (i:T) (i':T) = (i = i')
  19791.  
  19792.   fun lexlt (i:T) (i':T) = ((tostr i) < (tostr i'))
  19793.  
  19794.   end
  19795.   functor FileUtils(): FILEUTILS = struct
  19796.  
  19797.   fun open_fmeet_file fname =
  19798.       (open_in fname,fname)
  19799.       handle Io(s) => 
  19800.       (open_in (fname ^ ".fm"), fname ^ ".fm")
  19801.       handle Io(s) => 
  19802.       (open_in ("examples/" ^ fname), "examples/" ^ fname)
  19803.       handle Io(s) => 
  19804.       (open_in ("examples/" ^ fname ^ ".fm"), "examples/" ^ fname ^ ".fm")
  19805.       handle Io(s) => raise Io(fname ^ " not found")
  19806.  
  19807.   end
  19808.   functor ParseRes 
  19809.           (structure Typ: TYP
  19810.            structure Trm: TRM
  19811.            structure Globals: GLOBALS
  19812.            sharing Typ.Globals = Globals
  19813.            and Trm.Typ = Typ
  19814.           ) : PARSERES 
  19815.           = struct
  19816.  
  19817.   structure Typ = Typ
  19818.   structure Trm = Trm
  19819.   structure Globals = Globals
  19820.  
  19821.   datatype T =
  19822.       Leq of Typ.pretyp * Typ.pretyp
  19823.     | Type_Assumption of Globals.Id.T * Typ.pretyp
  19824.     | Type_Abbrev of Globals.Id.T * Typ.pretyp
  19825.     | Term_Def of Globals.Id.T * Trm.pretrm
  19826.     | Term_Assumption of Globals.Id.T * Typ.pretyp
  19827.     | Use of string
  19828.     | Set of string * string
  19829.     | Nothing
  19830.  
  19831.   end 
  19832.   (* ----------------------------------------------------------------------- *)
  19833.   (*                                       *)
  19834.   (* Low-level prettyprinting stream package.  Based on notes by Greg Nelson *)
  19835.   (*                                       *)
  19836.   (* ----------------------------------------------------------------------- *)
  19837.  
  19838.   functor Pp (structure Wr: WR) : PP =
  19839.   struct
  19840.  
  19841.   structure Wr = Wr
  19842.  
  19843.   (* ----------------------------------------------------------------------- *)
  19844.   (*                 Utilities                   *)
  19845.   (* ----------------------------------------------------------------------- *)
  19846.  
  19847.   val DEBUG = ref false;
  19848.  
  19849.   fun debug ss = if (!DEBUG) 
  19850.              then print ((implode ss) ^ "\n")
  19851.              else ()
  19852.  
  19853.   fun mapunit f = 
  19854.       let fun m ([]) = ()
  19855.         | m (hd::tl) = ((f hd); m tl)
  19856.       in m
  19857.       end
  19858.  
  19859.   (* ----------------------------------------------------------------------- *)
  19860.   (*                  Data Structures                   *)
  19861.   (* ----------------------------------------------------------------------- *)
  19862.  
  19863.   datatype BreakBehavior =
  19864.       NLINDENT of int
  19865.     | EXPLICIT of string
  19866.  
  19867.   datatype Token = 
  19868.       CHAR of int
  19869.     | SETB
  19870.     | ENDB
  19871.     | BREAK of {united:bool, do_what:BreakBehavior}
  19872.     | LONG of string
  19873.  
  19874.   datatype RefList =
  19875.       NIL 
  19876.     | CONS of Token * (RefList ref)
  19877.  
  19878.   exception CalledErrorCont
  19879.   val error_cont : unit cont = 
  19880.       callcc (fn k => (callcc (fn ek => throw k ek); raise CalledErrorCont))
  19881.  
  19882.   exception CoroutineBug
  19883.   exception PPQueueOverflowed
  19884.  
  19885.   type Pp = {wr:Wr.Wr, 
  19886.         q: Token array,
  19887.         qr: int ref, 
  19888.         inp: int ref, 
  19889.         m1: int ref,
  19890.         m2: int ref,
  19891.         m3: int ref,
  19892.         outq: Token array,
  19893.         outp: int ref,
  19894.         indent: int ref,
  19895.         margin: int ref,
  19896.         empty: unit cont ref,
  19897.         nonempty: unit cont ref}
  19898.  
  19899.   val qlen = 500;
  19900.   val outqlen = 500;
  19901.   val default_margin = 76;
  19902.  
  19903.   fun init_pp (wr:Wr.Wr) : Pp = 
  19904.       {wr = wr,
  19905.        q = array(qlen, CHAR(33)),
  19906.        qr = ref 0,
  19907.        inp = ref 0,
  19908.        m1 = ref 0,
  19909.        m2 = ref 0,
  19910.        m3 = ref 0,
  19911.        outq = array(outqlen, CHAR(33)),
  19912.        outp = ref 0,
  19913.        indent = ref 0,
  19914.        margin = ref default_margin,
  19915.        empty = ref(error_cont), 
  19916.        nonempty = ref(error_cont)}
  19917.  
  19918.   fun enqueue (pp:Pp) tok =
  19919.       let val {q=q, qr=qr, inp=inp, m1=m1, empty=empty, nonempty=nonempty, ...} 
  19920.           = pp
  19921.       val curqr = !qr
  19922.       val _ = debug ["enqueue: "," qr=",makestring (!qr),
  19923.                      " inp=",makestring (!inp),
  19924.                      " m1=",makestring (!m1)]
  19925.       in
  19926.      debug ["enqueue"];
  19927.      if ((curqr+1) mod qlen = (!inp)) orelse ((curqr+1) mod qlen = (!m1)) 
  19928.         then raise PPQueueOverflowed
  19929.         else ();
  19930.      update(q, curqr, tok);
  19931.      qr := (curqr + 1) mod qlen;
  19932.      debug ["enqueue: about to switch"];
  19933.      callcc (fn k => (empty := k; throw (!nonempty) ()));
  19934.      debug ["enqueue: returning"]
  19935.       end
  19936.  
  19937.   fun requeue (pp:Pp) =
  19938.       let val {q=q, qr=qr, inp=inp, empty=empty, nonempty=nonempty, m1=m1, ...} 
  19939.           = pp
  19940.       val _ = debug ["requeue: "," qr=",makestring (!qr),
  19941.                      " inp=",makestring (!inp),
  19942.                      " m1=",makestring (!m1)]
  19943.       in 
  19944.      inp := ((!inp) - 1) mod qlen
  19945.       end
  19946.  
  19947.   fun dequeue (pp:Pp) =
  19948.       let val {q=q, qr=qr, inp=inp, empty=empty, nonempty=nonempty, m1=m1, ...} 
  19949.           = pp
  19950.       val _ = debug ["dequeue: "," qr=",makestring (!qr),
  19951.                      " inp=",makestring (!inp),
  19952.                      " m1=",makestring (!m1)]
  19953.       val _ = (* Front make sure there's something to dequeue *)
  19954.           callcc (fn k => 
  19955.               (debug ["dequeue: checking for input"];
  19956.                if (!inp) = (!qr) 
  19957.                    then (debug ["dequeue: blocking"];
  19958.                      nonempty := k; 
  19959.                      throw (!empty) ())
  19960.                else ()))
  19961.       val _ = debug ["dequeue: unblocked"]
  19962.       val _ = if (!inp)<0 orelse (!inp)>qlen 
  19963.              then print ("About to crash: "^(makestring (!inp))^"\n")
  19964.              else ()
  19965.       val c = q sub (!inp)
  19966.       val _ = inp := ((!inp) + 1) mod qlen
  19967.       in 
  19968.      debug ["dequeue: returning"];
  19969.      c
  19970.       end
  19971.  
  19972.   (* ----------------------------------------------------------------------- *)
  19973.   (*                Processing                   *)
  19974.   (* ----------------------------------------------------------------------- *)
  19975.  
  19976.   exception LineTooLong
  19977.   exception HowdThatGetInHere
  19978.  
  19979.   fun raw_printline (pp as {wr=wr, outq=outq, outp=outp, ...}:Pp) =
  19980.     let val i = ref 0
  19981.     in 
  19982.        while ((!i)<(!outp)) do
  19983.          (case outq sub (!i) of
  19984.           CHAR(c) => Wr.write_wr wr (chr c)
  19985.         | LONG(s) => Wr.write_wr wr s
  19986.         | _ => raise HowdThatGetInHere;
  19987.           i := (!i)+1)
  19988.     end 
  19989.  
  19990.   fun write_tok (pp as {outq=outq, outp=outp, 
  19991.             indent=indent, margin=margin, ...}:Pp) 
  19992.         c raiseok =
  19993.       let in
  19994.       update (outq,!outp,c);
  19995.       if (!outp) < outqlen 
  19996.          then outp := (!outp)+1
  19997.          else ();
  19998.       case c of
  19999.           CHAR(10) => (raw_printline pp;
  20000.                indent := 0;
  20001.                outp := 0)
  20002.         | _        => (indent := (!indent)+1;
  20003.                     if (!indent) > (!margin)
  20004.                        andalso raiseok
  20005.                       then raise LineTooLong 
  20006.                       else ())
  20007.       end
  20008.  
  20009.   fun do_break pp indent (NLINDENT(n)) =
  20010.       let val i = ref 0
  20011.       in
  20012.     write_tok pp (CHAR(10)) true;
  20013.     while ((!i)<n+indent) do
  20014.       (write_tok pp (CHAR(32)) true;
  20015.        i := (!i)+1)
  20016.       end
  20017.     | do_break pp indent (EXPLICIT(s)) =
  20018.       mapunit (fn s => enqueue pp (CHAR(ord s))) (explode s)
  20019.  
  20020.   fun P1 pp = 
  20021.       let fun loop() = 
  20022.            (debug ["P1_loop"];
  20023.         case dequeue pp of
  20024.             (c as CHAR(_)) => (write_tok pp c true; loop())
  20025.           | (c as LONG(_)) => (write_tok pp c true; loop())
  20026.           | SETB => (P1 pp; loop())
  20027.           | BREAK(_) => loop()
  20028.           | ENDB => ())
  20029.       in debug ["P1"];
  20030.      loop();
  20031.      debug ["P1: finished"]
  20032.       end
  20033.  
  20034.   and P2 pp = 
  20035.       let fun loop() = 
  20036.            (debug ["P2_loop"];
  20037.         case dequeue pp of
  20038.             (c as CHAR(_)) => (write_tok pp c true; loop())
  20039.           | (c as LONG(_)) => (write_tok pp c true; loop())
  20040.           | SETB => (P1 pp; loop())
  20041.           | BREAK(_) => ()
  20042.           | ENDB => ())
  20043.       in debug ["P2"];
  20044.      loop();
  20045.      (* I think the input queue needs to be backed up by one now, so that
  20046.         P3 sees this SETB or BREAK... *)
  20047.      requeue pp;
  20048.      debug ["P2: finished"]
  20049.       end
  20050.  
  20051.   and P3 (pp as {inp=inp, outp=outp, indent=indent, 
  20052.          m1=m1, m2=m2, m3=m3, ...} :Pp) = 
  20053.       let val saved_indent = !indent
  20054.       fun loop() = 
  20055.            (debug ["P3_loop"];
  20056.         case dequeue pp of
  20057.             (c as CHAR(_)) => (write_tok pp c false; loop())
  20058.           | (c as LONG(_)) => (write_tok pp c false; loop())
  20059.           | SETB => (PP pp; loop())
  20060.           | BREAK({united=true,do_what=do_what}) => 
  20061.             (do_break pp saved_indent do_what;
  20062.              m1 := ~1; (* Not in CGN's original note *)
  20063.              loop())
  20064.           | BREAK({united=false,do_what=do_what}) => 
  20065.             (m1 := (!inp); m2 := (!outp); m3 := (!indent);
  20066.              ((P2 pp; 
  20067.                m1 := ~1; (* This once seemed wrong *)
  20068.                debug ["P3: looping back"]; 
  20069.                loop())
  20070.               handle LineTooLong =>
  20071.                  (debug ["P3: line too long"];
  20072.                   inp := (!m1); outp := (!m2); indent := (!m3);
  20073.                   do_break pp saved_indent do_what;
  20074.                   m1 := ~1;
  20075.                   loop())))
  20076.           | ENDB => ())
  20077.       in debug ["P3"];
  20078.      loop()
  20079.       end
  20080.  
  20081.   and PP (pp as {inp=inp, outp=outp, indent=indent, 
  20082.          m1=m1, m2=m2, m3=m3, ...} :Pp) = 
  20083.       let 
  20084.       in debug ["PP"];
  20085.      m1 := (!inp); m2 := (!outp); m3 := (!indent);
  20086.      (P1 pp; m1 := ~1; debug ["PP finished"])
  20087.      handle LineTooLong 
  20088.        => (debug ["PP: line too long"];
  20089.            inp := (!m1); outp := (!m2); indent := (!m3);
  20090.            m1 := ~1;
  20091.            P3 pp)
  20092.       end
  20093.  
  20094.   exception EndbWithNoMatchingSetb
  20095.   fun top_level pp = 
  20096.       let 
  20097.       in debug ["top_level"];
  20098.      P3 pp;
  20099.      raise EndbWithNoMatchingSetb
  20100.       end
  20101.  
  20102.   (* ----------------------------------------------------------------------- *)
  20103.   (*                Interaction                   *)
  20104.   (* ----------------------------------------------------------------------- *)
  20105.  
  20106.   fun setb pp = enqueue pp SETB
  20107.  
  20108.   fun endb pp = enqueue pp ENDB
  20109.  
  20110.   fun break pp b i = enqueue pp (BREAK {united=b, do_what=(NLINDENT i)})
  20111.  
  20112.   fun expbreak pp b s = enqueue pp (BREAK {united=b, do_what=(EXPLICIT s)})
  20113.  
  20114.   fun pwrite (pp as {wr=wr, ...} : Pp) s = 
  20115.       (debug ["write: '", s, "'"];
  20116.        mapunit (fn s => case ord(s) of
  20117.               10 => break pp true 0
  20118.             | i  => enqueue pp (CHAR(i)))
  20119.            (explode s))
  20120.  
  20121.   exception IllegalMargin
  20122.  
  20123.   fun set_margin (pp as {margin=margin, outp=outp , ...} : Pp) n =
  20124.       if (!outp) > n orelse n >= outqlen
  20125.      then raise IllegalMargin
  20126.      else margin := n
  20127.  
  20128.   (* ----------------------------------------------------------------------- *)
  20129.   (*                  Creation                   *)
  20130.   (* ----------------------------------------------------------------------- *)
  20131.  
  20132.   fun pp_from_wr wr =
  20133.       let val _ = debug ["new"];
  20134.       val (pp as {empty=empty, ...}:Pp) = init_pp wr
  20135.       in 
  20136.      callcc (fn k => (empty := k; top_level pp));
  20137.      pp
  20138.       end
  20139.  
  20140.   fun wr_from_pp (pp as {wr=wr, ...} : Pp)
  20141.       = Wr.to_fn (fn s => pwrite pp s) (fn () => Wr.close wr)
  20142.  
  20143.   end (* Functor Pp *)
  20144.  
  20145.   functor Wr () : WR =
  20146.   struct
  20147.  
  20148.   datatype wr = 
  20149.       WR of wr_spc * unit
  20150.  
  20151.   and wr_spc = 
  20152.       TO_STDOUT
  20153.     | TO_FILE of string * outstream
  20154.     | TO_WRS of wr list
  20155.     | TO_STRING of string list ref
  20156.     | TO_FN of (string->unit) * (unit->unit)
  20157.     | TO_NOWHERE 
  20158.  
  20159.   type Wr = wr
  20160.  
  20161.   fun new spc = WR(spc, ())
  20162.  
  20163.   fun to_stdout () = new (TO_STDOUT)
  20164.  
  20165.   fun to_file name = 
  20166.       let val out = open_out name
  20167.       in new (TO_FILE(name,out))
  20168.       end
  20169.  
  20170.   fun to_wrs wrs = new (TO_WRS(wrs))
  20171.  
  20172.   fun to_fn f cl_f = new (TO_FN(f,cl_f))
  20173.  
  20174.   fun to_string () = new (TO_STRING(ref([]:string list)))
  20175.  
  20176.   fun to_nowhere () = new (TO_NOWHERE)
  20177.  
  20178.   exception Not_a_TOSTRING_Wr
  20179.  
  20180.   fun extract_str (WR(TO_STRING(ss),_)) = implode (rev (!ss))
  20181.     | extract_str _ = raise Not_a_TOSTRING_Wr
  20182.  
  20183.   fun mapunit f = 
  20184.       let fun m ([]) = ()
  20185.         | m (hd::tl) = ((f hd); m tl)
  20186.       in m
  20187.       end
  20188.  
  20189.   fun close (WR(spc,gen)) = 
  20190.       case spc of
  20191.      TO_STDOUT => ()
  20192.        | TO_FILE(name,out) => close_out out
  20193.        | TO_WRS(wrs) => mapunit close wrs
  20194.        | TO_FN(_,cl_f) => cl_f()
  20195.        | TO_STRING(ss) => ()
  20196.        | TO_NOWHERE => ()
  20197.  
  20198.   fun write_wr (WR(spc,gen)) s =
  20199.       case spc of
  20200.      TO_STDOUT => output(std_out,s)
  20201.        | TO_FILE(_,out) => output(out,s)
  20202.        | TO_WRS(wrs) => mapunit (fn wr => write_wr wr s) wrs
  20203.        | TO_FN(f,_) => f s
  20204.        | TO_STRING(ss) => ss := (s :: (!ss))
  20205.        | TO_NOWHERE => ()
  20206.  
  20207.   end 
  20208.  
  20209. Status: not a bug.  caused by illegal redundancy from include specs.
  20210.   See tests/bug406a.sml for shortened example.
  20211. ---------------------------------------------------------------------------
  20212. 430. Subscript in lookTycPath
  20213. Submitter: Dave MacQueen
  20214. Date: 8/3/91
  20215. Version: 0.70
  20216. Severity: serious
  20217. Problem: 
  20218.   Following code causes
  20219.     $$ lookTycPath 2: [2,0]
  20220.     tyconInContext: [2,0]
  20221.   messages in d70, indicating Subscript has been raised while
  20222.   interpreting a relative type address.
  20223. Code: 
  20224.   signature S2 =
  20225.   sig
  20226.     structure A : sig type t end
  20227.     datatype u = ITEM of A.t
  20228.   end;
  20229.  
  20230.   functor F(X : sig type v end ) =
  20231.   struct
  20232.     type w = X.v
  20233.   end;
  20234.  
  20235.   functor G(Y : S2) =
  20236.   struct
  20237.     structure B = F(struct type v = Y.u end)
  20238.   end;
  20239.  
  20240. Comments:
  20241. Problem is bad env passed to redefineCon (typing/functor.sml) during the
  20242. application of functor F within the body of G.  The env for the instantiated
  20243. body of F is being used to interpret the type of datacon ITEM from the
  20244. parameter Y: S2.  lookTycPath aborts with a Subscript exception, which
  20245. gets caught by ArrayExt.app in redoTycs.
  20246.  
  20247. Status: fixed in 0.73
  20248. ---------------------------------------------------------------------------
  20249. 431. ml_writev
  20250. Submitter: Dave Tarditi
  20251. Date: 7/1/91
  20252. Version: 0.69
  20253. Severity: minor
  20254. Problem: 
  20255.     The function ml_writev in cfuns.c for version 0.69 appears to have
  20256.     a bug; the reference to callc_v in it should have 1 added to it, since
  20257.     callc_v is a label that points to the tag of a closure, not
  20258.     the closure itself.  By the way, callc_v is defined in the
  20259.     header file prim.h.
  20260. Fix:
  20261.     The diff of the old version with the new version is below.
  20262.  
  20263.     570d569
  20264.     <         extern int callc_v[];
  20265.     577,578c576,577
  20266.     <         MLState->ml_closure = PTR_CtoML(callc_v);
  20267.     <         MLState->ml_pc        = CODE_ADDR(PTR_CtoML(callc_v));
  20268.     ---
  20269.     >         MLState->ml_closure = PTR_CtoML(callc_v+1);
  20270.     >         MLState->ml_pc        = CODE_ADDR(PTR_CtoML(callc_v+1));
  20271. Status: Fixed in 0.74 (or earlier).
  20272. ---------------------------------------------------------------------------
  20273. 432. corrupted (shell) environment
  20274. Submitter: Julian Bradfield <jcb@lfcs.edinburgh.ac.uk>
  20275. Date: 7/1/91
  20276. Version: 0.66
  20277. System: Sparc
  20278. Problem: 
  20279.     NJ SML version 0.66 (running on Sparc) sometimes corrupts its
  20280.     environment: after compiling a piece of code, executed sub-processes get
  20281.     an environment with (apparently) random characters added to
  20282.     environment values. (The specific piece of code is too long to include
  20283.     here; I don't know how general the problem is.)
  20284. Comment: [dbm] sent mail asking for code to reproduce the problem.
  20285.     This is the same as #342.  [Bradfield confirms that problem is fixed in
  20286.     0.75 in mail sent 12/5/91.]
  20287. Status: fixed in 0.74 (JHR)
  20288. ---------------------------------------------------------------------------
  20289. 433. lexgen bug
  20290. Submitter: Julian Bradfield <jcb@lfcs.edinburgh.ac.uk>
  20291. Date: 7/1/91
  20292. Version: 0.66
  20293. Problem: 
  20294.   In the lexgen.sml distributed with 0.66, there is a bug at line
  20295.   1047; when outputting the arguments for the "action" function, there
  20296.   should be a test for !UsesTrailingContext . If true, should the third
  20297.   argument just be nil ?
  20298. Status: fixed in 0.74
  20299. ---------------------------------------------------------------------------
  20300. 434. interactive input
  20301. Submitter: Lawrence Paulson <Larry.Paulson@computer-lab.cambridge.ac.uk>
  20302. Date: 1/1/91
  20303. Version: 0.66 (and later)
  20304. Problem: 
  20305.   I think there's something strange with interactive I/O.  Consider the
  20306.   following:
  20307.  
  20308.   fun prs s = output(std_out,s);
  20309.   val pause_tac = Tactic (fn state => 
  20310.     (prs"** Press RETURN to continue: ";
  20311.      if input(std_in,1) = "\n" then Sequence.single state
  20312.      else (prs"Goodbye\n";  Sequence.null)));
  20313.  
  20314.   New Jersey ML waits for input and prints the prompt afterwards.  The behavior
  20315.   of ML's I/O is not precisely defined, but most languages flush any awaiting
  20316.   output before demanding input.
  20317.  
  20318.   Really, I would like to accept single-character inputs (rather than lines
  20319.   ending with CR) but Standard ML seems to have no suitable primitive!
  20320. Status: not really a bug, but a sensible request
  20321. ---------------------------------------------------------------------------
  20322. 435. patrow syntax
  20323. Submitter:      Matti Jokinen, moj@utu.fi
  20324. Date:        28-Jul-1991
  20325. Version:        0.69
  20326. System:         Sun 3
  20327. Severity:       minor
  20328.  
  20329. Problem:        The compiler fails to accept the following patrow syntax:
  20330.  
  20331.             id:ty as pat
  20332.  
  20333. Code:           fun f {x:int as y} = x;
  20334.  
  20335. Transcript:     - fun f {x:int as y} = x;
  20336.         Error: Compiler bug: patType -- unexpected pattern
  20337.  
  20338. Comments:    The following patterns are translated correctly:
  20339.  
  20340.             {x = x:int as y}
  20341.             {x as y}
  20342.             {x:int}
  20343.  
  20344.         I think the bug is caused by a missing branch is in the
  20345.         patType function (lines 128-194 in src/typing/typecheck.sml).
  20346.         The parser appears to transform `id:ty as pat' into
  20347.         LAYEREDpat(CONSTAINTpat(_,ty),pat), which is not recognized
  20348.         by patType.
  20349. Status: fixed in 0.74
  20350. ---------------------------------------------------------------------------
  20351. 436. debugger type checking
  20352. Submitter:      Sergio Antoy, antoy@cs.pdx.edu
  20353. Date:           Jul 1, 1991
  20354. Version:        0.66
  20355. System:         Sparc IPC, SunOS 4.1.1
  20356. Problem:        the debugger reports tycon mismatch on a correct program
  20357. Code:
  20358.   (* dec (x,l) is the string decimal representation of x over l characters,
  20359.      right justified. If l characters are not enough, then l "*" are returned.
  20360.      If l <= 0, then an exception is raised. *)
  20361.   
  20362.   exception wrong_field_size
  20363.   fun dec (x, l) =
  20364.     if l <= 0
  20365.       then raise wrong_field_size
  20366.       else 
  20367.         let fun dok (0, "") = "0"
  20368.               | dok (0, s) = s
  20369.               | dok (x, s) = dok (x div 10, chr(x mod 10 + ord("0")) ^ s)
  20370.             fun fill (s, l) =
  20371.               if size s > l
  20372.                 then
  20373.                   let fun dc 0 = ""
  20374.                         | dc l = "*" ^ dc (l-1)
  20375.                   in
  20376.                     dc l
  20377.                   end
  20378.                 else
  20379.                   let fun dc 0 = ""
  20380.                         | dc l = " " ^ dc (l-1)
  20381.                   in
  20382.                     dc (l - size s) ^ s
  20383.                   end
  20384.         in if x < 0
  20385.              then fill ( "-" ^ (dok (~x, "")), l)
  20386.              else fill (dok (x, ""), l)
  20387.         end
  20388.   
  20389. Transcript:
  20390.   Standard ML of New Jersey, Version 0.66, 15 September 1990
  20391.   val it = () : unit
  20392.   - emacsInit (); cd "/home/antares/pizza/users/antoy/programs/sml/random-dir/";
  20393.   val it = () : unit
  20394.   val it = () : unit
  20395.   - usedbg "format.sml";
  20396.   [opening /home/antares/pizza/users/antoy/programs/sml/random-dir/format.sml]
  20397.   
  20398.   [Major collection... 63% used (1343748/2106244), 1520 msec]
  20399.   
  20400.   [Increasing heap to 4104k]
  20401.   exception wrong_field_size
  20402.   val dec = fn : int * int -> string
  20403.   [closing /home/antares/pizza/users/antoy/programs/sml/random-dir/format.sml]
  20404.   val it = () : unit
  20405.   - run "dec(12,4)";
  20406.   [opening <instream>]
  20407.   <instream>:1.1-1.9 Error: operator and operand don't agree (tycon mismatch)
  20408.     operator domain: int ref
  20409.     operand:         int * int
  20410.     in expression:
  20411.       dec (12,4)
  20412.   [closing <instream>]
  20413.   - dec(12,4);
  20414.   val it = "  12" : string
  20415.   - 
  20416. Comments:    Under epoch 3.2.4
  20417.         The debugger works for a trivial factorial program.
  20418.  
  20419.  
  20420. From apt@Princeton.EDU Tue Jul  2 10:28:41 1991
  20421. This is indeed a (minor) bug, which I'll handle in due course.
  20422. The problem seems to be that the run function is hiding the user's 
  20423. (re-)definition of dec with the pervasive Integer.dec.
  20424. There is a trivial work-around: call the user function something different.
  20425.  
  20426. Status: fixed as of 0.88
  20427. ---------------------------------------------------------------------------
  20428. 437. mlyacc syntax problem
  20429. Submitter: Andrew Wright <wright@rice.edu>
  20430. Date: 7/3/91
  20431. Version: 0.69
  20432. Problem: 
  20433. The source file "yacc.sml" of mlyacc from the 0.69 release does not compile
  20434. under the 0.69 release because of a syntax error at line 350:
  20435.  
  20436.              EAPP(EVAR(valueStruct^"."^
  20437.                  if hasType (NONTERM lhs)
  20438.                   then saySym(NONTERM lhs)
  20439.                                   else ntvoid),
  20440. Fix:
  20441. The "if then else" needs to be parenthesized.
  20442.  
  20443. Status: fixed in 0.73
  20444. ---------------------------------------------------------------------------
  20445. 438. callcc typing unsound
  20446. Submitter: Robert Harper <rwh@proof.ergo.cs.cmu.edu>
  20447. Date: 7/3/91
  20448. Version: 0.70
  20449. Severity: critical
  20450. Problem: 
  20451.   Recently Mark Lillibridge and I have been trying to investigate a
  20452.   number of questions of type soundness in the presence of polymorphism
  20453.   and control operators.  As you may recall, I have been unable to find
  20454.   a cps transform that (1) is faithful to the ML operational semantics,
  20455.   and (2) admits a suitable typing result to guarantee soundness in
  20456.   Milner's sense.  We discovered that the central issue is to do with
  20457.   the scope of type variables.  This got us to thinking, and late last
  20458.   night Mark came up with the following example which demonstrates that
  20459.   ML with callcc and polymorphism is UNSOUND.  Run it in SML/NJ to see
  20460.   what I mean.  We plan to investigate the matter further, and will keep
  20461.   you posted.
  20462. Code: 
  20463.   fun left (x,y) = x;
  20464.   fun right (x,y) = y;
  20465.  
  20466.   let val later = (callcc (fn k =>
  20467.       (  fn x => x,  fn f => throw k (f, fn f => ())  ) ))
  20468.   in
  20469.       print (left(later)"hello");
  20470.       right(later)(fn x => x+2)
  20471.   end
  20472. Fix:
  20473.   Making the type of callcc weakly polymorphic appears to fix the problem.
  20474. Status: fixed in 0.73 (by making callcc weakly polymorphic)
  20475. ---------------------------------------------------------------------------
  20476. 439. lexgen
  20477. Submitter: Julian Bradfield <jcb@lfcs.edinburgh.ac.uk>
  20478. Date: 7/8/91
  20479. Version: 0.66
  20480. Problem: 
  20481.   lexgen.sml distributed with NJ SML 0.66, lines 983 to 986.
  20482.   The variable i in the pattern clashes with i in a pattern much higher
  20483.   up. I *think* that all occurrences of i in these four lines should be 
  20484.   k, say, while the i on line 987 is indeed i.
  20485.   (The symptom of this bug is uncaught Substring exceptions, when a
  20486.   state identifier gets passed as a length to accept.)
  20487.  
  20488.   Has anybody got the look-ahead facility of ML-Lex to work?
  20489. Comment: Tarditi noticed that the ASU lookahead algorithm is buggy, so
  20490.      this feature has been removed.
  20491. Status: fixed in 0.74
  20492. ---------------------------------------------------------------------------
  20493. 440. missing Perv.mos
  20494. Submitter:  Matti Jokinen, moj@utu.fi
  20495. Date:        15-Jun-1991
  20496. Version:    0.69, 0.70, possibly others
  20497. System:     all
  20498. Severity:   major
  20499.  
  20500. Problem:    File src/runtime/Perv.mos is missing.
  20501.         Consequently, `makeml -pervshare' fails.
  20502.  
  20503. Command:    makeml -sun3 sunos -pervshare
  20504.  
  20505. Transcript: makeml -sun3 sunos -pervshare
  20506.         ./makeml> (cd runtime; make clean)
  20507.         rm -f *.o lint.out prim.s linkdata allmo.s run
  20508.         ./makeml> rm -f mo
  20509.         ./makeml> ln -s ../mo.m68 mo
  20510.         ./makeml> (cd runtime; rm -f run allmo.o allmo.s)
  20511.         ./makeml> (cd runtime; make MACHINE=M68  'CFL=-n ' 'DEFS= -DBSD -Dsun3 -DSUNOS -
  20512.         DRUNTIME=\"runtime\"' linkdata)
  20513.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS -DRUNTIME=\"runtime\" -o linkdata linkdata.c
  20514.         (cd runtime; grep -v mo/Math.mo Perv.mos > Tmp.mos)
  20515.     --->    grep: Perv.mos: No such file or directory
  20516.         ./makeml> runtime/linkdata [runtime/Tmp.mos]
  20517.         runtime/linkdata> as runtime/allmo.s -o runtime/allmo.o
  20518.         ./makeml> (cd runtime; make  MACHINE=M68  'DEFS= -DBSD -Dsun3 -DSUNOS' CPP=/lib/
  20519.         cpp 'CFL=-n ' 'AS=as')
  20520.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  run.c
  20521.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  run_ml.c
  20522.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  callgc.c
  20523.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  gc.c
  20524.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  M68.dep.c
  20525.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  export.c
  20526.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  timers.c
  20527.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  ml_objects.c
  20528.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  cfuns.c
  20529.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  cstruct.c
  20530.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  signal.c
  20531.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  exncode.c
  20532.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS  -target sun3 -c  malloc.c
  20533.         /lib/cpp -DASM -DM68 -DBSD -Dsun3 -DSUNOS M68.prim.s > prim.s
  20534.         as -o prim.o prim.s
  20535.         cc -O -n -DM68 -DBSD -Dsun3 -DSUNOS -o run run.o run_ml.o callgc.o gc.o M68.dep.
  20536.         o export.o timers.o  ml_objects.o cfuns.o cstruct.o signal.o exncode.o malloc.o
  20537.         prim.o allmo.o
  20538.         Undefined
  20539.         _datalist
  20540.         *** Error code 2
  20541.         make: Fatal error: Command failed for target `run'
  20542.  
  20543. Fix:        Copy the missing file from distribution 0.66.
  20544. Status: fixed in 0.73
  20545. ---------------------------------------------------------------------------
  20546. 441. parsing large positive integers
  20547. Submitter:      Olaf Burkart <burkart@zeus.informatik.rwth-aachen.de>
  20548. Date:           7/16/90
  20549. Version:        0.69
  20550. System:         SPARC, SunOS 4.1
  20551. Problem:
  20552. I have found the following bug in sml 0.69:
  20553.  
  20554. Can't parse large positive integers.
  20555. Can't load the Edinburgh SML Library.
  20556.  
  20557. Problem (1):        2^30 - 1 (maxint) could not be read
  20558. -----------
  20559. Transcript:     
  20560.  
  20561. Standard ML of New Jersey, Version 0.69, 3 April 1991
  20562. - ~1073741824;
  20563. val it = ~1073741824 : int
  20564. - 1073741823;
  20565.  
  20566. uncaught exception Overflow
  20567. Comment: [dbm] Is this the same as bug 327, which is claimed to be fixed in 0.69?
  20568. Status: Fixed in 0.72. This is related to bug 327 and 444 [lg].
  20569. ---------------------------------------------------------------------------
  20570. 442. Runbind exception
  20571. Submitter:      Olaf Burkart <burkart@zeus.informatik.rwth-aachen.de>
  20572. Date:           7/16/90
  20573. Version:        0.69
  20574. System:         SPARC, SunOS 4.1
  20575. Problem:
  20576. It seems to me that the Runbind error from BUG 262. is back again.
  20577. I tried to load the Edinburgh SML Library, but after fixing problem (1)
  20578. the sml interpreter aborts with "uncaught exception Runbind" in the structure
  20579. definition:
  20580.  
  20581. structure Int: INT =
  20582. struct
  20583.     ...
  20584.   exception Overflow = Overflow
  20585.   and Div = Div
  20586.     ...
  20587. end
  20588. Status: probably fixed; can't check without source (related bug 419 is fixed)
  20589. ---------------------------------------------------------------------------
  20590. 443. equality attributes in datatype specs
  20591. Submitter: Colin Meldrum <colin@harlqn.co.uk>
  20592. Date: Wed, 17 Jul 91
  20593. Version: 0.66
  20594. Problem: 
  20595. In New Jersey v66, the following signature does not elaborate:
  20596.  
  20597. signature S =
  20598.   sig
  20599.     type 'a s
  20600.  
  20601.     datatype t = A of int -> int
  20602.  
  20603.     datatype
  20604.       v = D of w s
  20605.     and
  20606.       w = E of t
  20607.   end
  20608.  
  20609. It gives the error:
  20610.  
  20611. std_in:16.5-24.2 Error: inconsistent equality properties
  20612.  
  20613. However, by swapping the two datdesc clauses in the final datatype spec the
  20614. signature can be made to elaborate correctly:
  20615.  
  20616. signature S =
  20617.   sig
  20618.     type 'a s
  20619.  
  20620.     datatype t = A of int -> int
  20621.  
  20622.     datatype
  20623.       w = E of t
  20624.     and
  20625.       v = D of w s
  20626.   end
  20627.  
  20628. Status: fixed in 0.73
  20629. ---------------------------------------------------------------------------
  20630. 444. large constants and Overflow
  20631. This is an supplement to the bug:
  20632.     327 large constants cause overflow in compilation
  20633.     from Apr 23.
  20634. Submitter: 
  20635.     Juergen Buntrock,
  20636.     TU-Berlin,
  20637.     jubu@cs.tu-berlin.de
  20638. Date: Tue Apr 23 13:50:05 MET DST 1991
  20639. Version: 0.70
  20640. System: Sun4-60 / SunOS Release 4.1.1
  20641. Problem: 
  20642.     The function primops in (cps/cpsopt.sml line 658) transforms
  20643.     integer compare operation somtimes in arithmetic
  20644.     operations which may raise Overflow.
  20645.  
  20646.     An example is function sizeImmed (in sparc/sparc.sml).
  20647.     This functions raise an Overflow  for constant values
  20648.     bigger than (maxinit-4096)
  20649.  
  20650.  
  20651. Script:
  20652. Script started on Tue Jul 30 12:57:30 1991
  20653. jubu@flp 1) smln70
  20654. Standard ML of New Jersey, Version 0.70, 1 July 1991
  20655. val it = () : unit
  20656. - structure TT = struct
  20657. =     datatype A = A | B
  20658. =     fun sizeImmed n = if (~4096 <= n) andalso(n < 4096)
  20659. =         then A else B
  20660. =     val sizeImmed = fn n =>
  20661. =         (sizeImmed n) handle Overflow => (
  20662. =             outputc std_out (implode[
  20663. =                 "sizeImmed(",makestring n,
  20664. =                 ") overflow!\n"]);
  20665. =             raise Overflow )
  20666. =     val x = 107374182
  20667. =     val z = (sizeImmed (x * 10 + 2))
  20668. =     end
  20669. = ;
  20670. sizeImmed(1073741822) overflow!
  20671.  
  20672. uncaught exception Overflow
  20673.  
  20674. Status: Fixed in 0.72. This is had to do with an illegal 
  20675.         optimization and a bug in the sparc code generator [lg].
  20676. ---------------------------------------------------------------------------
  20677. 445. spurious error report
  20678. Submitter: Andrew Tolmach <apt@cs.princeton.edu>
  20679. Date: 7/30/91
  20680. Version: 0.70
  20681. Problem: 
  20682.   Following produces a spurious error in 0.70.
  20683. Code: 
  20684.  
  20685.   signature  T = 
  20686.   sig
  20687.    datatype debuglevel = A of instream option
  20688.   end
  20689.  
  20690. Status: fixed in 0.73
  20691. ---------------------------------------------------------------------------
  20692. 446. Compiler bug
  20693. Submitter:      jont%uk.co.harlqn@uk.ac.ukc
  20694. Date:        01/08/91
  20695. Version:        SML of NJ version number 0.66
  20696. System:         Sun 4/330 with SunOS 4.1.1
  20697. Severity:       minor
  20698. Problem:        Compiler warns of compiler bug in compiling some
  20699.         incorrect code
  20700. Code:
  20701. (* _mirprint.sml the functor *)
  20702. (*
  20703. $Log:    _mirprint.sml,v $
  20704. Revision 1.3  91/07/30  16:22:11  jont
  20705. Printed more opcodes (branch and cgt)
  20706.  
  20707. Revision 1.2  91/07/26  20:00:13  jont
  20708. Redid some printing in light of changes in mirtypes
  20709.  
  20710. Revision 1.1  91/07/25  15:45:09  jont
  20711. Initial revision
  20712.  
  20713. Copyright (c) 1991 Harlequin Ltd.
  20714. *)
  20715.  
  20716. require "../utils/integer";
  20717. require "../basics/identprint";
  20718. require "../lambda/pretty";
  20719. require "../lambda/lambdasub";
  20720. require "mirtypes";
  20721. require "mirprint";
  20722.  
  20723. functor MirPrint(
  20724.   structure Integer : INTEGER
  20725.   structure IdentPrint : IDENTPRINT
  20726.   structure MirTypes : MIRTYPES
  20727.   structure Pretty : PRETTY
  20728.   structure LambdaSub : LAMBDASUB
  20729.   sharing IdentPrint.Ident = MirTypes.Ident
  20730.   hsaring MirTypes.LambdaTypes = LambdaSub.LambdaTypes
  20731. ) : MIRPRINT =
  20732. struct
  20733.   structure MirTypes = MirTypes
  20734.   structure P = Pretty
  20735.  
  20736.   exception pretty_not_done_yet
  20737.  
  20738.   fun decode_binary MirTypes.ADD = "ADD "
  20739.   | decode_binary MirTypes.SUB = "SUB "
  20740.   | decode_binary MirTypes.MUL = "MUL "
  20741.   | decode_binary MirTypes.DIV = "DIV "
  20742.   | decode_binary MirTypes.REM = "REM "
  20743.   | decode_binary MirTypes.AND = "AND "
  20744.   | decode_binary MirTypes.OR = "OR "
  20745.   | decode_binary MirTypes.EOR = "EOR "
  20746.   | decode_binary MirTypes.SHL = "SHL "
  20747.   | decode_binary MirTypes.SHR = "SHR "
  20748.   | decode_binary MirTypes.SHRL = "SHRL "
  20749.   | decode_binary MirTypes.DIVL = "DIVL "
  20750.   | decode_binary MirTypes.REML = "REML "
  20751.  
  20752.   fun decode_unary MirTypes.CMP = "CMP "
  20753.   | decode_unary MirTypes.CMPL = "CMPL "
  20754.   | decode_unary MirTypes.MOV = "MOV "
  20755.   | decode_unary MirTypes.NEG = "NEG "
  20756.   | decode_unary MirTypes.NOT = "NOT "
  20757.  
  20758.   fun decode_store MirTypes.LDX = "LDX "
  20759.   | decode_store MirTypes.STX = "STX "
  20760.  
  20761.   fun decode_allocate MirTypes.ALLOC = "ALLOC "
  20762.   | decode_allocate MirTypes.ALLOC_REAL = "ALLOC_REAL "
  20763.   | decode_allocate MirTypes.ALLOC_STRING = "ALLOC_STRING "
  20764.  
  20765.   fun decode_branch MirTypes.BRA = "BRA "
  20766.   | decode_branch MirTypes.BEQ = "BEQ "
  20767.   | decode_branch MirTypes.BNE = "BNE "
  20768.   | decode_branch MirTypes.BHI = "BHI "
  20769.   | decode_branch MirTypes.BLS = "BLS "
  20770.   | decode_branch MirTypes.BHS = "BHS "
  20771.   | decode_branch MirTypes.BLO = "BLO "
  20772.   | decode_branch MirTypes.BGT = "BGT "
  20773.   | decode_branch MirTypes.BLE = "BLE "
  20774.   | decode_branch MirTypes.BGE = "BGE "
  20775.   | decode_branch MirTypes.BLT = "BLT "
  20776.   | decode_branch MirTypes.BVS = "BVS "
  20777.   | decode_branch MirTypes.BVC = "BVC "
  20778.   | decode_branch MirTypes.BMI = "BMI "
  20779.   | decode_branch MirTypes.BPL = "BPL "
  20780.  
  20781.   fun decode_adr MirTypes.LEA = "LEA "
  20782.  
  20783.   fun decode_real_gc(MirTypes.GC_REAL gc_reg) =
  20784.     "REG " ^ MirTypes.print_gc_register gc_reg
  20785.   | decode_real_gc(MirTypes.GC_SPILL i) =
  20786.     "SPILL " ^ Integer.makestring i
  20787.  
  20788.   fun decode_real_non_gc(MirTypes.NON_GC_REAL gc_reg) =
  20789.     "REG " ^ MirTypes.print_non_gc_register gc_reg
  20790.   | decode_real_non_gc(MirTypes.NON_GC_SPILL i) =
  20791.     "SPILL " ^ Integer.makestring i
  20792.  
  20793.   fun decode_reg_operand(MirTypes.GC_REG(gc_reg, real_gc_reg_opt)) =
  20794.     "GC(" ^ MirTypes.print_gc_register gc_reg ^
  20795.     (case real_gc_reg_opt of
  20796.       MirTypes.ABSENT => ""
  20797.     | MirTypes.PRESENT real_gc => decode_real_gc real_gc)
  20798.     ^ ") "
  20799.   | decode_reg_operand(MirTypes.NON_GC_REG(non_gc_reg, real_non_gc_reg_opt)) =
  20800.     "NON_GC(" ^ MirTypes.print_non_gc_register non_gc_reg ^
  20801.     (case real_non_gc_reg_opt of
  20802.       MirTypes.ABSENT => ""
  20803.     | MirTypes.PRESENT real_non_gc => decode_real_non_gc real_non_gc)
  20804.     ^ ") "
  20805.  
  20806.   fun decode_gp_op(MirTypes.GP_GC_REG(gc_reg, real_gc_reg_opt)) =
  20807.     "GC(" ^ MirTypes.print_gc_register gc_reg ^
  20808.     (case real_gc_reg_opt of
  20809.       MirTypes.ABSENT => ""
  20810.     | MirTypes.PRESENT real_gc => decode_real_gc real_gc)
  20811.     ^ ") "
  20812.   | decode_gp_op(MirTypes.GP_NON_GC_REG(non_gc_reg, real_non_gc_reg_opt)) =
  20813.     "NON_GC(" ^ MirTypes.print_non_gc_register non_gc_reg ^
  20814.     (case real_non_gc_reg_opt of
  20815.       MirTypes.ABSENT => ""
  20816.     | MirTypes.PRESENT real_non_gc => decode_real_non_gc real_non_gc)
  20817.     ^ ") "
  20818.   | decode_gp_op(MirTypes.GP_IMM_INT imm) =
  20819.     "Int(" ^ Integer.makestring imm ^ ") "
  20820.   | decode_gp_op(MirTypes.GP_IMM_ANY imm) =
  20821.     "Any(" ^ Integer.makestring imm ^ ") "
  20822.  
  20823.   fun decode_op(MirTypes.BINARY(binary_op, reg_op, gp_op1, gp_op2)) =
  20824.     decode_binary binary_op ^ decode_reg_operand reg_op ^
  20825.     decode_gp_op gp_op1 ^ decode_gp_op gp_op2
  20826.   | decode_op(MirTypes.UNARY(unary_op, reg_op, gp_op)) =
  20827.     decode_unary unary_op ^ decode_reg_operand reg_op ^ decode_gp_op gp_op
  20828.   | decode_op(MirTypes.STOREOP(store_op, reg_op1, reg_op2, gp_op)) =
  20829.     decode_store store_op ^ decode_reg_operand reg_op1 ^
  20830.     decode_reg_operand reg_op2 ^ decode_gp_op gp_op
  20831.   | decode_op(MirTypes.ALLOCATE(allocate, gc_reg, imm)) =
  20832.     decode_allocate allocate ^ "GC(" ^ MirTypes.print_gc_register gc_reg ^
  20833.     ") " ^
  20834.     (case allocate of MirTypes.ALLOC_REAL => "" | _ => Integer.makestring imm)
  20835.   | decode_op(MirTypes.BRANCH(branch, tag)) =
  20836.     decode_branch branch ^ MirTypes.print_tag tag
  20837.   | decode_op(MirTypes.SWITCH(cgt, reg_op, tag_list)) =
  20838.     LambdaSub.reduce_left
  20839.     (fn (s, tag) => s ^ " " ^ MirTypes.print_tag tag)
  20840.     ("CGT " ^ decode_reg_operand reg_op, tag_list)
  20841.   | decode_op(MirTypes.VALUE scon) = (case scon of
  20842.       IdentPrint.Ident.REAL _ => "Real "
  20843.     | IdentPrint.Ident.STRING _ => "String "
  20844.     | _ => raise(LambdaSub.LambdaTypes.impossible"VALUE(int)")) ^ 
  20845.     IdentPrint.printSCon scon
  20846.   | decode_op(MirTypes.ADR(adr, reg_op, tag)) =
  20847.     decode_adr adr ^ decode_reg_operand reg_op ^ " " ^ MirTypes.print_tag tag
  20848.     (* Information points *)
  20849.   | decode_op(MirTypes.LOC_REF tag_list) =
  20850.     LambdaSub.reduce_left op ^
  20851.     ("Local references\n",
  20852.       map (fn tag => MirTypes.print_tag tag ^ " ") tag_list)
  20853.   | decode_op MirTypes.END = "End of code"
  20854.   | decode_op _ = raise(pretty_not_done_yet)
  20855. (*
  20856.   | decode_op(MirTypes.BINARYFP of binary_fp_op * fp_register * fp_register * fp_operand |
  20857.   | decode_op(MirTypes.UNARYFP of unary_fp_op * fp_register * fp_operand |
  20858.   | decode_op(MirTypes.STACKOP of stack_op * reg_operand |
  20859.   | decode_op(MirTypes.STOREFPOP of store_fp_op * fp_register * reg_operand * gp_operand |
  20860.   | decode_op(MirTypes.CONVOP of int_to_float * fp_register * reg_operand |
  20861.   | decode_op(MirTypes.BRANCH_AND_LINK of branch_and_link * bl_dest |
  20862.   | decode_op(MirTypes.INIT of any_register | (* Register is initialised here *)
  20863.   | decode_op(MirTypes.USE of any_register | (* Register is used here *)
  20864.   | decode_op(MirTypes.ENTER of int * reg_operand |
  20865.     (* Entry point for procedure, with n locals and arg reg *)
  20866.   | decode_op(MirTypes.EXIT of reg_operand | (* Return point from procedure, result in reg *)
  20867.     (* Data *)
  20868. *)
  20869.  
  20870.   fun decode_block(MirTypes.BLOCK(tag, op_list)) =
  20871.     P.blk(0, P.lst("", [P.nl], "")
  20872.       (P.blk(2, [P.str("Tag "), P.str(MirTypes.print_tag tag)]) ::
  20873.         (map (fn x => P.str("  " ^ decode_op x)) op_list)))
  20874.  
  20875.   fun print_mir_code(MirTypes.CODE block_list) =
  20876.     P.string_of_T(P.blk(0, P.lst("", [P.nl], "")
  20877.             (map decode_block block_list)))
  20878. end
  20879.  
  20880. Transcript:
  20881. make "../mir/_mirprint.sml";
  20882. [opening /home/ml/jont/ml/ml_compiler/src/mir/_mirprint.sml]
  20883. val it = () : unit
  20884. val it = () : unit
  20885. val it = () : unit
  20886. val it = () : unit
  20887. val it = () : unit
  20888. val it = () : unit
  20889. /home/ml/jont/ml/ml_compiler/src/mir/_mirprint.sml:30.3-30.9 Error: syntax error: inserting OPEN
  20890. /home/ml/jont/ml/ml_compiler/src/mir/_mirprint.sml:30.3-30.54 Error: unbound structure in signature: hsaring
  20891. /home/ml/jont/ml/ml_compiler/src/mir/_mirprint.sml:30.3-30.54 Error: unbound structure in signature: MirTypes.LambdaTypes
  20892. Error: Compiler bug: lookPathSTRinSig.get
  20893. [closing /home/ml/jont/ml/ml_compiler/src/mir/_mirprint.sml]
  20894.  
  20895. Comments:    The code is incorrect, but it shouldn't cause the
  20896. compiler to claim it has a bug in itself! The cause seems somewhat
  20897. related to the fact that MirTypes has no substructure LambdaTypes,
  20898. simply misspelling sharing on a line which is an otherwise valid
  20899. sharing constraint line does not exhibit the problem.
  20900.  
  20901. Status: possibly fixed in 0.73?  (incomplete source, can't test)
  20902. ---------------------------------------------------------------------------
  20903. 447. identity type abbreviation
  20904. Submitter:      tmb@ai.mit.edu
  20905. Date:           08/02/91
  20906. Version:        0.70
  20907. System:         Sun4/OS4.1.1
  20908. Severity:       ?
  20909. Problem:        the type checker refuses to accept the following definition
  20910. Code:
  20911.  
  20912. structure S =
  20913.     struct
  20914.     type 'b data = 'b list
  20915.     type 'b value = 'b
  20916.     fun at(x:'b data):'b value = hd x
  20917.     end;
  20918.  
  20919. Transcript:
  20920.  
  20921.    hack.sml:5.2-5.34 Error: expression and constraint don't agree (bound type var)
  20922.      expression: 'bU
  20923.      constraint: 'bU value
  20924.      in expression:
  20925.        Initial.hd x
  20926.  
  20927. Comments:
  20928.  
  20929.    I'm not sure whether this is a bug, but certain types of functors
  20930.    seem to be difficult to express if you cannot write definitions like
  20931.    this.
  20932.  
  20933.    In particular, it seems like I have to write two separate functors
  20934.    depending on whether "'b value" is simply "'b" or whether it
  20935.    is some other type dependent on "'b" (e.g., "'b list"). This
  20936.    seems very unnatural.
  20937.  
  20938. signature S =
  20939.     sig
  20940.     type 'a data
  20941.     type 'a value
  20942.     val at: 'b data -> 'b value
  20943.     end;
  20944.  
  20945. functor F(structure X:S) =
  20946.     struct
  20947.     open X
  20948.     fun pair_at x = (at x,at x)
  20949.     end;
  20950.  
  20951. structure A =
  20952.     struct
  20953.     type 'a data = 'a list
  20954.     type 'a value = 'a list
  20955.     val at = (fn x => x)
  20956.     end;
  20957.  
  20958. structure FA = F(structure X = A);
  20959.     
  20960. structure B =
  20961.     struct
  20962.     type 'a data = 'a list
  20963.     type 'a value = 'a
  20964.     val at = hd
  20965.     end;
  20966.  
  20967. (* why can't I do this??? *)
  20968.  
  20969. structure FB = F(structure X = B);
  20970. Fix: type abbreviations must be expanded when unifying with UBOUND type variables
  20971.      in Unify (basics/unify.sml).  The definition of equalTypes in TypesUtil
  20972.      must be changed in a similar manner.
  20973. Status: fixed in 0.74
  20974. ---------------------------------------------------------------------------
  20975. 448. failure to build on MIPS 6280
  20976. Submitter: Dave MacQueen
  20977. Date: 8/10/91
  20978. Version: 0.71
  20979. System: MIPS 6280, RISCOS 4.52
  20980. Severity: critical (for 6280)
  20981. Problem: failure while trying to bootstap the compiler
  20982. Transcript: 
  20983.   % makeml -mips riscos -batch -m 60000 
  20984.   makeml> (cd runtime; make clean)
  20985.       rm -f *.o lint.out prim.s linkdata allmo.s run
  20986.   makeml> rm -f mo
  20987.   makeml> ln -s ../mo.mipsb mo
  20988.   makeml> (cd runtime; rm -f run allmo.o allmo.s)
  20989.   makeml> (cd runtime; make MACHINE=MIPS  'CFL= -systype bsd43' 'LIBS=' 'DEFS= -DRISCos -DRUNTIME=\"runtime\"' linkdata)
  20990.       cc -O -systype bsd43 -DMIPS -DRISCos -DRUNTIME=\"runtime\" -o linkdata linkdata.c
  20991.   makeml> runtime/linkdata [runtime/CompMipsBig.mos]
  20992.   runtime/linkdata> as runtime/allmo.s -o runtime/allmo.o
  20993.   makeml> (cd runtime; make  MACHINE=MIPS  'DEFS= -DRISCos' 'CPP=/lib/cpp -P' 'CFL= -systype bsd43' 'AS=as' 'LIBS=')
  20994.       cc -O -systype bsd43 -DMIPS -DRISCos -c run.c
  20995.       cc -O -systype bsd43 -DMIPS -DRISCos -c run_ml.c
  20996.       cc -O -systype bsd43 -DMIPS -DRISCos -c callgc.c
  20997.       cc -O -systype bsd43 -DMIPS -DRISCos -c gc.c
  20998.  
  20999.   uopt: Warning: gc: this procedure not optimized because it
  21000.     exceeds size threshold; to optimize this procedure, use -Olimit option
  21001.     with value >=  553.
  21002.       cc -O -systype bsd43 -DMIPS -DRISCos -c MIPS.dep.c
  21003.       cc -O -systype bsd43 -DMIPS -DRISCos -c export.c
  21004.       cc -O -systype bsd43 -DMIPS -DRISCos -c timers.c
  21005.       cc -O -systype bsd43 -DMIPS -DRISCos -c ml_objects.c
  21006.       cc -O -systype bsd43 -DMIPS -DRISCos -c cfuns.c
  21007.       cc -O -systype bsd43 -DMIPS -DRISCos -c cstruct.c
  21008.       cc -O -systype bsd43 -DMIPS -DRISCos -c signal.c
  21009.       cc -O -systype bsd43 -DMIPS -DRISCos -c exncode.c
  21010.       cc -O -systype bsd43 -DMIPS -DRISCos -c malloc.c
  21011.       cc -O -systype bsd43 -DMIPS -DRISCos -c mp.c
  21012.       cc -O -systype bsd43 -DMIPS -DRISCos -c sync.c
  21013.       /lib/cpp -P -DASM -DMIPS -DRISCos MIPS.prim.s > prim.s
  21014.       as -o prim.o prim.s
  21015.   as0: Warning: prim.s, line 281: missing .end preceding this .ent: set_request
  21016.     .ent set_request
  21017.   as0: Warning: prim.s, line 281: .ent/.end block never defined the procedure name
  21018.   as0: Warning: prim.s, line 407: missing .end preceding this .ent: go
  21019.     .ent go
  21020.       cc -O -systype bsd43 -DMIPS -DRISCos -o run run.o run_ml.o callgc.o gc.o MIPS.dep.o export.o timers.o  ml_objects.o cfuns.o cstruct.o signal.o exncode.o malloc.o  mp.o sync.o prim.o allmo.o 
  21021.   makeml> runtime/run -m 60000 -r 5 -h 2048 CompMipsBig
  21022.  
  21023.   [Increasing heap to 2048k]
  21024.   [Loading mo/CoreFunc.mo]
  21025.   [Executing mo/CoreFunc.mo]
  21026.   [Loading mo/Math.mo]
  21027.   [Executing mo/Math.mo]
  21028.   [Loading mo/Initial.mo]
  21029.   [Executing mo/Initial.mo]
  21030.   Uncaught exception CFunNotFound with "argv"
  21031.   9.2u 7.8s 1:22 20% 182+737k 1269+1532io 2586pf+0w
  21032.  
  21033. Comments:
  21034.   The as0 warnings should be eliminated, and the -Olimit flag added or changed
  21035.   so that the gc code can be optimized.
  21036. Status: Fixed in 0.78
  21037. ---------------------------------------------------------------------------
  21038. 449. poor error message for mismatching datatype spec
  21039. Submitter: John Reppy (jhr@cs.cornell.edu)
  21040. Date: Mar 5 1991
  21041. Version: 0.66-0.69
  21042. Severity: minor
  21043. Problem: 
  21044.  
  21045. Here is another example of an error message that doesn't give enough
  21046. info:
  21047.  
  21048.   user/drawing.sml:9.3-12.5 Error: mismatching datatype spec: pen_val_t
  21049.  
  21050. In this case, pen_val_t has ~30 variants; figuring out the mismatch is
  21051. a pain.  This is like the problem with large labeled records.
  21052.   - John
  21053. Status: fixed in 0.91 (dbm)
  21054. ---------------------------------------------------------------------------
  21055. 450. Compiler bug: tycPath
  21056. Submitter: Andy Koenig (dopey!ark)
  21057. Date: 10/16/91
  21058. Version: 0.66
  21059. Severity: minor
  21060. Problem: After an unmatched type spec there is a Compiler bug message.
  21061. Transcript: 
  21062.   - signature I = sig type T end;
  21063.   signature I =
  21064.     sig
  21065.       type T
  21066.     end
  21067.   - abstraction J : I = struct type u = int end;
  21068.   std_in:1.21-1.43 Error: unmatched type spec: T
  21069.   Error: Compiler bug: tycPath
  21070. Status: fixed in 0.74
  21071. ---------------------------------------------------------------------------
  21072. 451. sharing constraints
  21073. Submitter: Mike Crawley <mjc@abstract-hardware-ltd.co.uk>
  21074. Date: 10/29/91
  21075. Version: 0.73
  21076. Severity: serious
  21077. Problem: 
  21078.   SML/NJ 0.73 gets the sharing constraints wrong in the following ML.
  21079. Code: 
  21080.   signature A = sig structure Base:sig end end;
  21081.  
  21082.   signature P = sig end;
  21083.  
  21084.   functor A (structure P:P) : A =
  21085.   struct
  21086.     structure Base = P;
  21087.   end;
  21088.  
  21089.   signature B = sig structure Base:sig end end;
  21090.  
  21091.   functor B (structure P:P structure A:A sharing P = A.Base ) : B =
  21092.   struct
  21093.     structure Base = P;
  21094.   end;
  21095.  
  21096.   functor Q(structure P : P
  21097.         structure A : A 
  21098.         structure B : B 
  21099.         sharing P = A.Base = B.Base) = struct end ;
  21100.  
  21101.   structure P = struct end ;
  21102.  
  21103.   structure A = A(structure P = P);
  21104.   structure B = B(structure P = P structure A = A);
  21105.  
  21106.   structure Q = Q(structure P = P
  21107.           structure A = A
  21108.           structure B = B);
  21109.  
  21110. Status: fixed in 0.75
  21111. ---------------------------------------------------------------------------
  21112. 452. finding out what is in a structure
  21113. Submitter:      Tim Freeman, tsf@cs.cmu.edu
  21114. Date:        Wed Oct 30 15:30:02 1991
  21115. Version:        0.74
  21116. System:         Sun 4
  21117. Severity:       minor but chronic
  21118. Problem:        I used to be able to find out what was in a structure
  21119.         by opening it up.  Now there is apparently no way to
  21120.         remind myself of what is in a structure other than by
  21121.         reading the source.
  21122. Transcript:     - structure x = SourceGroup;
  21123.         structure x : SOURCEGROUP
  21124.         (* This used to tell me all of the things in the
  21125.         SourceGroup structure. *)
  21126.         - open x;
  21127.         open x
  21128.         (* I would be just as happy if this printed out the
  21129.         information I want too. *)
  21130. Comments:    Maybe this feature should have its own name, instead
  21131.         of hanging off of top level structure declarations.
  21132. ---------------------------------------------------------------------------
  21133. 453. unhandled exception crashes sml
  21134. Submitter:      Tim Freeman <tsf@cs.cmu.edu>
  21135. Date:        Thu Oct 31 15:32:46 1991
  21136. Version:        0.74
  21137. System:         Sun 4 running some version of Mach
  21138. Severity:       minor
  21139. Problem:        With some manipulations of structures, raising
  21140.         unhandled exceptions causes SML to bomb.
  21141. Code:           bug3.sml contains:
  21142.         structure Util = 
  21143.             struct
  21144.             exception Bug of string
  21145.             end
  21146.         
  21147.         structure InstProto = 
  21148.         struct
  21149.             structure U = Util
  21150.             structure S = struct end 
  21151.         end 
  21152.         
  21153.         open InstProto
  21154.         ;
  21155.         raise U.Bug "hi"
  21156.  
  21157. Transcript:     % sml
  21158.         Standard ML of New Jersey, Version 0.74, 10 October, 1991
  21159.         Prerelease version.  Arrays have changed; see doc/NEWS
  21160.         val it = () : unit
  21161.         - use "bug3.sml";
  21162.         [opening bug3.sml]
  21163.         structure Util : 
  21164.           sig
  21165.             exception Bug of string
  21166.           end
  21167.         structure InstProto : 
  21168.           sig
  21169.             structure S : ...
  21170.             structure U : ...
  21171.           end
  21172.         open InstProto
  21173.         SIGILL code 0x7
  21174.         %                 
  21175. Comments:    Earlier during the process of narrowing down this bug,
  21176.         it was saying 
  21177.  
  21178.             uncaught exception random binary garbage
  21179.  
  21180.         (except you have to imagine the string "random binary
  21181.         garbage" replaced by random binary garbage) instead of
  21182.         getting the SIGILL trap. 
  21183. Status: fixed in 0.75
  21184. ---------------------------------------------------------------------------
  21185. 454. running out of memory
  21186. Submitter: Andy Koenig
  21187. Date: 11/7/91
  21188. Version: 0.74
  21189. System: SPARCstation, 64MB
  21190. Severity: minor
  21191. Problem: 
  21192.   SML-NJ is not very nice about handling memory exhaustion.
  21193. Transcript: 
  21194.  
  21195.     [boojum] sml
  21196.     Standard ML of New Jersey, Version 0.74, 10 October, 1991
  21197.     Prerelease version.  Arrays have changed; see doc/NEWS
  21198.     val it = () : unit
  21199.     - fun f x = f(0::x);
  21200.     val f = fn : int list -> 'a
  21201.     - f nil;
  21202.  
  21203.     [Increasing heap to 3164k]
  21204.  
  21205.     [Increasing heap to 4452k]
  21206.  
  21207.     [Increasing heap to 5456k]
  21208.  
  21209.     [Major collection...
  21210.     [Increasing heap to 8192k]
  21211.      76% used (3427160/4508104), 2610 msec]
  21212.  
  21213.     [Increasing heap to 13192k]
  21214.  
  21215.     [Major collection... 49% used (4497848/8999168), 4600 msec]
  21216.  
  21217.     [Increasing heap to 26380k]
  21218.  
  21219.     [Major collection... 49% used (8999168/18002072), 9250 msec]
  21220.  
  21221.     [Increasing heap to 27204k]
  21222.  
  21223.     [Major collection...
  21224.     [Increasing heap to 27620k]
  21225.  
  21226.     [Increasing heap to 27776k]
  21227.  
  21228.     [Increasing heap to 27860k]
  21229.  
  21230.     [Increasing heap to 27880k]
  21231.  
  21232.     Warning: can't increase heap
  21233.  
  21234.     Ran out of memory[boojum] 
  21235. Comments:
  21236.     While I do ultimately expect some kind of drastic termination,
  21237.     I do **NOT** expect to be unceremoniously dumped out of ML back
  21238.     into the Shell.  A more reasonable strategy might be to preallocate
  21239.     a chunk of memory to be used as secondary storage while recovering
  21240.     from exhaustion of primary storage.  That, at least, would allow
  21241.     for a return to top level and associated garbage collection, which,
  21242.     in many cases, would allow interactive execution to resume.
  21243.  
  21244.     Incidentally, this example was run on a Sparcstation with 64
  21245.     megabytes of physical memory and no limit on process size
  21246.     that I know of.  I don't know why it gave up the ghost at
  21247.     28 megabytes -- do you?
  21248. Status: open
  21249. ---------------------------------------------------------------------------
  21250. 455. handling Real.Div
  21251. Submitter:      olender@cs.colostate.edu <Kurt Olender>
  21252. Date:           Nov. 11, 1991
  21253. Version:        0.75
  21254. System:         Sparcstation-2/SunOS 4.1.1
  21255. Severity:       minor
  21256. Problem:        cannot handle Real.Div exception
  21257. Code:           1.0/0.0 handle Real.Div => 10.0;
  21258. Transcript:     
  21259.         (* At top level *)
  21260.         (* Integer works *)
  21261.         - 1 div 0 handle Integer.Div => 10;
  21262.         val it = 10 : int
  21263.  
  21264.         (* Real doesn't *)
  21265.         - 1.0/0.0 handle Real.Div => 10.0;
  21266.  
  21267.         uncaught exception Div
  21268.  
  21269.         (* Even when I don't specify the name *)
  21270.         - 1.0/0.0 handle _ => 10.0;
  21271.  
  21272.         uncaught exception Div
  21273. Fix:
  21274.   This was a bug in the scheduler dependencies for the SPARC.
  21275. Status: fixed in 0.76
  21276. ---------------------------------------------------------------------------
  21277. 456. signals on SPARC cause heap corruption
  21278. Submitter:      tyan@cs.cornell.edu & Greg_Morrisett@CS.CMU.EDU
  21279. Date:           Nov. 20, 1991
  21280. Version:        0.75 (and earlier)
  21281. System:         Sparc
  21282. Severity:       minor
  21283. Problem:        programs using signals to do pre-emption get corrupted heaps.
  21284. Code:
  21285. (* A simple preemptive thread structure *)
  21286. structure T =
  21287.     struct
  21288.     (* Queues *)
  21289.     type '1a queue = ('1a list ref * '1a list ref)
  21290.     fun create () = (ref [], ref [])
  21291.     fun enq ((f,r), x) = r := x :: (!r)
  21292.     fun deq (f,r) = 
  21293.         (case (!f) of
  21294.          (hd::tl) => (f := tl; SOME hd)
  21295.            | [] => (case (rev (!r)) of
  21296.                 (hd::tl) => (f := tl; r := [];
  21297.                      SOME hd)
  21298.               | [] => NONE))
  21299.  
  21300.     (* Flag for atomicity *)
  21301.     val atomic = ref false
  21302.  
  21303.     (* Ready queue *)
  21304.     val ready : unit cont queue = create ()
  21305.  
  21306.     exception Deadlock
  21307.  
  21308.     fun enterAtomic () = atomic := true
  21309.     fun leaveAtomic () = atomic := false
  21310.  
  21311.     fun reschedule k = enq (ready, k)
  21312.  
  21313.     fun get_next () = 
  21314.         case (deq ready) of
  21315.         NONE => raise Deadlock
  21316.           | SOME k => k
  21317.  
  21318.     (* fork a thread *)
  21319.     fun fork f =
  21320.         (enterAtomic ();
  21321.          callcc (fn c => (reschedule c;
  21322.                   leaveAtomic ();
  21323.                   f ();
  21324.                   enterAtomic ();
  21325.                   throw (get_next ()) ()));
  21326.          leaveAtomic ())
  21327.  
  21328.     fun prepend f kont = 
  21329.         (callcc (fn c => (callcc (fn k => (throw c k));
  21330.                   f ();
  21331.                   throw kont ())))
  21332.  
  21333.     (* context switch signal handler *)
  21334.     fun handler (n,kont) = 
  21335.         if (!atomic) then (kont)
  21336.         else
  21337.         (enterAtomic ();
  21338.          reschedule (prepend leaveAtomic kont);
  21339.          get_next ())
  21340.  
  21341.     local
  21342.         open System.Signals System.Timer System.Unsafe.CInterface
  21343.         val t0 = TIME {sec=0,usec=0}
  21344.     in
  21345.         val _ = setHandler (SIGALRM, SOME handler)
  21346.  
  21347.         fun setPreempt NONE = setitimer(0,t0,t0)
  21348.           | setPreempt (SOME t) =
  21349.         let val t = TIME {sec=0,usec=1000*t}
  21350.         in
  21351.             setitimer(0,t,t)
  21352.         end
  21353.     end
  21354.  
  21355.     end
  21356.  
  21357. fun spin_alloc l = spin_alloc (rev l);  (* make sure we fool compiler *)
  21358. fun spin () = spin_alloc [1,2];
  21359.  
  21360. fun bug () = (T.setPreempt (SOME 50);
  21361.           T.fork spin; T.fork spin; T.fork spin)
  21362.  
  21363. Fix:
  21364.   The problem was that the SPARC has no callee saved FP registers, so the
  21365.   resumption continuation was pointing to its own descriptor.
  21366.  
  21367. Status: fixed in 0.76
  21368. ---------------------------------------------------------------------------
  21369. 457. Real.ceiling has wrong type
  21370. Submitter:      Lal George
  21371. Date:           Nov. 22, 1991
  21372. Version:        0.75 (and earlier)
  21373. System:         all
  21374. Severity:       minor
  21375. Problem:        Real.ceiling has wrong type
  21376. Code:
  21377.   - ceiling;
  21378.   val it = fn : real -> 'a
  21379. Remark:
  21380.   yet another example of the brain damage in perv.sml
  21381. Status: fixed in 0.76
  21382. ---------------------------------------------------------------------------
  21383. 458. incorrect 'Warning: binding not exhaustive' message
  21384. Submitter:      Lal George
  21385. Date:        Nov. 27, 1991
  21386. Version:        0.75 (and earlier)
  21387. System:         all
  21388. Severity:       minor
  21389. Code:           
  21390.  
  21391.     datatype register = Reg of int | Freg of int
  21392.     datatype ea = Direct of register | Immed of int 
  21393.     val dataptr as Direct dataptr' = Direct(Reg 23)
  21394.  
  21395. Transcript: 
  21396.     
  21397. - val dataptr as Direct dataptr' = Direct(Reg 23);
  21398. std_in:4.1-4.47 Warning: binding not exhaustive
  21399.         dataptr as Direct dataptr' = ...
  21400. val dataptr = Direct (Reg 23) : ea
  21401. val dataptr' = Reg 23 : register
  21402. Comment: [dbm] Further static analysis could verify that this
  21403.   pattern would be matched, but this analysis is not done.
  21404. Status: not a bug
  21405. ---------------------------------------------------------------------------
  21406. 459. signature matching
  21407. Submitter:      Robert Thau, rst@ai.mit.edu
  21408. Date:           10 December 1991
  21409. Version:        75
  21410. System:         Sparcstation 1 / SunOS 4.1.1
  21411. Severity:       
  21412. Problem:        The following two lines of admittedly questionable
  21413.         code seem to throw the SML/NJ compiler into a loop,
  21414.         madly consing with no apparent end in sight.
  21415.  
  21416. Code:           
  21417.     signature foosig = sig val foo: 'a -> int end;
  21418.     structure foostruct:foosig = struct fun foo x = x end;
  21419.  
  21420. Status: fixed in 0.80 (or earlier)
  21421. ---------------------------------------------------------------------------
  21422. 460. signature matching
  21423. Submitter:    Tsung-Min Kuo    (email : kuo@ecrc.de)
  21424. Date:        Dec 12, 1991
  21425. Version:        Version 0.75, November 11, 1991
  21426. System:         SPARCstation 1, SUNOS 4.1
  21427. Severity:    VERY severe
  21428. Problem:        Compiler blowup --- use up 24M heap
  21429. Code:
  21430.     signature A = sig val s : (unit -> 'a) -> unit end
  21431.     structure A : A = struct fun s f = f() end
  21432.  
  21433. Transcript:
  21434.  
  21435.     Standard ML of New Jersey, Version 75, November 11, 1991
  21436.     Arrays have changed; see Release Notes
  21437.     val it = () : unit
  21438.     - signature A = sig val s : (unit -> 'a) -> unit end;
  21439.     signature A = 
  21440.       sig
  21441.         val s : (unit -> 'a) -> unit
  21442.       end
  21443.     - structure A : A = struct fun s f = f() end;
  21444.     
  21445.     [Increasing heap to 10003k]
  21446.     
  21447.     [Major collection... 69% used (3607244/5171504), 6790 msec]
  21448.     
  21449.     [Increasing heap to 15147k]
  21450.     
  21451.     [Major collection...
  21452.     [Increasing heap to 23187k]
  21453.      80% used (7597900/9458020), 12920 msec]
  21454.     
  21455.     [Increasing heap to 23467k]
  21456.     
  21457.     [Major collection... 73% used (9457996/12885048), 17240 msec]
  21458.     
  21459.     [Increasing heap to 23575k]
  21460.     
  21461.     2[Major collection...
  21462.     [Increasing heap to 23647k]
  21463.     
  21464.     Warning: can't increase heap
  21465.     
  21466.     Ran out of memory
  21467.  
  21468. Comments: The signature was wrong. But, instead of reporting spec mismatch,
  21469.       it keeps on doing heap allocation until runs out of memory.
  21470.       By fixing the signature, or by avoiding signature constraint on
  21471.       the structure definition, we can get around the bug.
  21472.       The old version (0.66) seems working correctly on this example.
  21473.  
  21474. Submitter:      Francois Bourdoncle <bourdoncle@prl.dec.com>
  21475. Date:           3/13/92
  21476. Version:        0.75
  21477. System:         Ultrix 4.2 on a DECstation 5200 (but also VAX 8600)
  21478. Problem:        compiler loops on erroneous signature matching
  21479. Code:
  21480.  
  21481.     signature SIG =
  21482.       sig
  21483.         val F : 'a -> unit
  21484.       end
  21485.     
  21486.     structure S : SIG =
  21487.       struct
  21488.         fun F x = x
  21489.       end;
  21490.  
  21491. Transcript:
  21492.  
  21493.     Standard ML of New Jersey, Version 75, November 11, 1991
  21494.     Arrays have changed; see Release Notes
  21495.     val it = () : unit
  21496.     - use "bug.sml";
  21497.     [opening bug.sml]
  21498.     
  21499.     [Increasing heap to 4058k]
  21500.     
  21501.     [Increasing heap to 7678k]
  21502.     
  21503.     [Increasing heap to 14398k]
  21504.     
  21505.     [Increasing heap to 16386k]
  21506.     
  21507.     [Major collection... 69% used (5815684/8396812), 7367 msec]
  21508.     
  21509.     [Increasing heap to 24602k]
  21510.     ^C[closing bug.sml]
  21511.  
  21512.     Interrupt
  21513.     - ^C
  21514.  
  21515. Status: fixed in 0.80 (or earlier)
  21516. ---------------------------------------------------------------------------
  21517. 461. overloading and weak polymorphism
  21518. Submitter:      jont@uk.co.harlqn
  21519. Date:
  21520. Version:        SML of NJ version number, 0.75
  21521. System:         Sun 4/330 with SunOS 4.1.1
  21522. Severity:       minor
  21523. Problem:        Problem with weak type variables
  21524. Code:
  21525.  
  21526.     local
  21527.       val x = ref nil
  21528.     in
  21529.       fun define(y: string list) = x := y
  21530.     end;
  21531.  
  21532. Transcript:
  21533.     - use "bug461.sml";
  21534.     bug461.sml:5.3-5.17 Error: nongeneric weak type variable
  21535.       x : '0Z list ref
  21536.     [closing bug461.sml]
  21537.  
  21538. Comments: 0.66 accepted this quite happily. As far as I can see,
  21539.   there is no problem deducing the type of overloads
  21540.  
  21541. Status: fixed in 0.89
  21542. ---------------------------------------------------------------------------
  21543. 462. location info in inexhaustive pattern warnings
  21544. Submitter: Bob Harper (Robert_Harper@cs.cmu.edu)
  21545. Date: 12/4/91
  21546. Version: 0.75
  21547. Problem: 
  21548.     My inexhaustive pattern warnings come out thus these days:
  21549.  
  21550.     .../src/type-check.sml:0.0-0.0 Warning: match not exhaustive
  21551.  
  21552.     The line and column number are not 0!  The messages always have 0 for both.
  21553. Comment: Is marking turned off?
  21554. Status: fixed in 0.89
  21555. ---------------------------------------------------------------------------
  21556. 463. unmatched datatype in signature matching
  21557. Submitter : Sylvie Thiebaux  sylvie@gmd.de
  21558. Date 10 - 07 - 91
  21559. Version SML 0.66
  21560. Severity major (critical ?)
  21561. Problem :  unmatched datatype
  21562. Code :
  21563. I cannot narrow down the cause of the problem more than I have already done.
  21564. I have got several files in which I let only the necessary things. All the
  21565. files excpeted the main file can be compliled. When I compile the main file
  21566. I get the error ``unmatched datatype literal'' at the point indicated in the
  21567. program. It is maybe a problem of a sharing constraint on this type that I have given in the file LOGIC.sml. But I have already used the LOGIC signature
  21568. in a larger programm and this sharing constraint seemed to cause no problem.
  21569.  
  21570. Here are all the modules involved in the error message. Please do not be
  21571. surprised about what each module contains. I need each of them but I wanted to
  21572. let in each of them only the minimal necessary code in order to make your task
  21573. easier.
  21574.  
  21575. (*file ELEMENT.sml*)
  21576. signature ELEMENT =
  21577.     sig
  21578.     type element
  21579.     val  put : outstream -> element -> unit 
  21580.     end
  21581.  
  21582. (************************************************************)
  21583.  
  21584. (*file EQ.sml*)
  21585. import "ELEMENT";
  21586.  
  21587. signature EQ =
  21588.     sig
  21589.     include ELEMENT
  21590.     val eq : element -> element -> bool
  21591.     end
  21592.  
  21593. (**********************************************************)
  21594.  
  21595. (*file SET.sml*)
  21596. import "EQ";
  21597.  
  21598. signature SET =
  21599.     sig
  21600.     structure Eq : EQ
  21601.         type element
  21602.         sharing type element = Eq.element
  21603.         type set;
  21604.         val empty_set : set (* unrelated to the error *)
  21605.     end
  21606.  
  21607. (**********************************************************)
  21608.  
  21609. (*file ListSet.sml*)
  21610. import "EQ";
  21611. import "SET";
  21612.  
  21613. functor ListSet (Eq' :EQ)  : SET  =  
  21614.     struct 
  21615.     structure Eq = Eq'
  21616.     type element = Eq.element
  21617.     type set = element list
  21618.     val empty_set :set = []
  21619.     end
  21620.  
  21621. (********************************************************)
  21622.  
  21623. (* file ATOMS.sml *)
  21624.  
  21625. signature ATOMS =
  21626.     sig
  21627.     type term
  21628.     type atom
  21629.     val eq_at : atom -> atom -> bool
  21630.     val put_at : outstream -> atom -> unit
  21631.     end
  21632.  
  21633. (******************************************************)
  21634.  
  21635. (*file LOGIC.sml*)
  21636. import "SET";
  21637. import "ATOMS";
  21638.  
  21639. signature LOGIC =
  21640.     sig
  21641.     structure At : ATOMS
  21642.  
  21643.     datatype literal =
  21644.         False 
  21645.       | True 
  21646.       | neg of At.atom 
  21647.       | pos of At.atom
  21648.  
  21649.      type conj_set
  21650.      structure CS : SET
  21651.      
  21652.      sharing type literal = CS.element (* if you remove this sharing
  21653. constraint, the error does not exist any more. But I need this constraint
  21654. and anyway, it caused no problem whith other big programms including this
  21655. signature *)
  21656.          and type conj_set = CS.set
  21657.   end
  21658.  
  21659. (************************************************************************)
  21660.  
  21661. (*file Logic.sml*)
  21662. import "ListSet";
  21663. import "ATOMS";
  21664. import "LOGIC";
  21665.  
  21666. functor Logic ( atoms : ATOMS ) : LOGIC =
  21667.     struct
  21668.     structure At = atoms
  21669.  
  21670.     datatype literal =
  21671.         pos of At.atom
  21672.       | neg of At.atom
  21673.       | True
  21674.       | False
  21675.  
  21676.     fun put_lit os (pos at) =
  21677.         At.put_at os at
  21678.       | put_lit os (neg at) = 
  21679.         ((output (os,"-"));
  21680.          (At.put_at os at))
  21681.       | put_lit os (True) =
  21682.         output(os,"true")
  21683.       | put_lit os (False) =
  21684.         output(os,"false")
  21685.     
  21686.     fun eq_lit (pos at1 :literal) (pos at2 :literal) =
  21687.         At.eq_at at1 at2
  21688.       | eq_lit (neg at1 :literal) (neg at2 :literal) =
  21689.         At.eq_at at1 at2
  21690.       | eq_lit True True =
  21691.         true
  21692.       | eq_lit False False =
  21693.         true
  21694.       | eq_lit _ _ =
  21695.         false
  21696.  
  21697.     structure CS = ListSet (struct
  21698.                     type element = literal
  21699.                     val eq = eq_lit
  21700.                     val put = put_lit
  21701.                 end)
  21702.     type conj_set = CS.set
  21703.     end
  21704.  
  21705. (*****************************************************************)
  21706.  
  21707. (*file LOGIC_JUSTIF.sml*)
  21708. import "LOGIC";
  21709.  
  21710. signature LOGIC_JUSTIF =
  21711.     sig
  21712.     structure L : LOGIC
  21713.         datatype rule = implication of L.literal list * L.literal
  21714.                       | inconsistency of L.literal list
  21715.     end
  21716.  
  21717. (***************************************************************)
  21718.  
  21719. (* file Logic_justif.sml*)
  21720. import "ATOMS";
  21721. import "Logic";
  21722. import "LOGIC_JUSTIF";
  21723.  
  21724.  
  21725. functor Logic_justif (atoms: ATOMS) : LOGIC_JUSTIF =
  21726.     struct
  21727.     structure L : LOGIC = Logic(atoms)
  21728.  
  21729.             datatype rule = implication of L.literal list * L.literal
  21730.                       | inconsistency of L.literal list
  21731.     end
  21732.  
  21733. (****************************************************************)
  21734.  
  21735. (*file LOGIC_JUSTIF_AND_INIT.sml *)
  21736. import "LOGIC_JUSTIF";
  21737.  
  21738. signature LOGIC_JUSTIF_AND_INIT =
  21739.     sig
  21740.     structure LJ : LOGIC_JUSTIF
  21741.         val background_knowledge : LJ.rule list
  21742.     end
  21743.  
  21744. (****************************************************************)
  21745.  
  21746. (* file POSS.sml *)
  21747. import "LOGIC";
  21748.  
  21749. signature POSS =
  21750.     sig
  21751.     structure L : LOGIC
  21752.     end
  21753.  
  21754. (***************************************************)
  21755.  
  21756. (*file Poss.sml *)
  21757. import "LOGIC_JUSTIF_AND_INIT";
  21758. import "POSS";
  21759.  
  21760. functor Poss (lji : LOGIC_JUSTIF_AND_INIT) : POSS =
  21761.     struct
  21762.     structure L = lji.LJ.L
  21763.     end
  21764.  
  21765. (***************************************************)
  21766.  
  21767. (*file  NOTHING.sml*)
  21768. import "POSS";
  21769.  
  21770. signature NOTHING =
  21771.     sig
  21772.     structure P : POSS
  21773.     end
  21774.  
  21775. (***********************************)
  21776.  
  21777. (* file Nothing.sml*)
  21778. import "POSS";
  21779. import "NOTHING";
  21780.  
  21781. functor Nothing (PW:POSS) : NOTHING =
  21782.     struct
  21783.     structure P = PW
  21784.     end
  21785.  
  21786. (***********************************)
  21787. (* main programm  : Block.sml*)
  21788. import "Logic_justif";
  21789. import "Poss";
  21790. import "NOTHING";
  21791. (* curiously, if you remove this last import, the error message does not
  21792. appear *)
  21793.  
  21794. structure atoms =
  21795.     struct
  21796.     datatype term = a | b | c 
  21797.     datatype atom =
  21798.                     on of term * term
  21799.                   | ontable of term
  21800.                   | holding of term
  21801.                   | clear of term
  21802.                   | handempty
  21803.        
  21804.     fun t2s a = "a"
  21805.       | t2s b = "b"
  21806.       | t2s c = "c"
  21807.  
  21808.     fun a2s (on(X,Y))   = "on("^(t2s X)^", "^(t2s Y)^")"
  21809.                   | a2s (ontable X) = "ontable("^(t2s X)^")"
  21810.                   | a2s (holding X) = "holding("^(t2s X)^")"
  21811.                   | a2s (clear X)   = "clear("^(t2s X)^")"
  21812.                   | a2s handempty   = "handempty"
  21813.        
  21814.     fun put_at os (at:atom) = output(os, a2s(at))
  21815.  
  21816.     fun eq_at (at1:atom) (at2:atom) = at1=at2
  21817.     
  21818.     end
  21819.  
  21820. structure logic_justif : LOGIC_JUSTIF = Logic_justif(atoms)
  21821. open logic_justif
  21822. open L
  21823. open atoms
  21824.  
  21825. val back_klg = nil
  21826.  
  21827. structure logic_justif_and_init : LOGIC_JUSTIF_AND_INIT =
  21828.   struct
  21829.       structure LJ = logic_justif
  21830.       val background_knowledge = back_klg
  21831.   end
  21832.  
  21833. (******************************************)
  21834.  
  21835. structure poss : POSS = Poss(logic_justif_and_init)
  21836. (* this is the line where the error message appears *)
  21837.  
  21838. Comment: may be fixed in 0.75 -- check.
  21839.  
  21840. Status: fixed in 0.88
  21841. ---------------------------------------------------------------------------
  21842. 464. defining exception as data constructor
  21843. Submitter: David Tarditi
  21844. Date: 7/19/91
  21845. Version: 0.70
  21846. Severity: minor
  21847. Problem: 
  21848.   The following results in a compiler bug message in version 0.70:
  21849.  
  21850.   datatype d = D;
  21851.   exception e = D;
  21852.  
  21853.   The error message is:
  21854.   Error: Compiler bug: in makedec EXCEPTIONdec
  21855.  
  21856. Comment:
  21857.  
  21858. This is probably due to the fact that exceptions and constructors
  21859. share the same name space.  A check that the binding for the rhs of
  21860. "exception e = ..." is an exception is probably missing.
  21861.  
  21862. Status: fixed in 0.75
  21863. ---------------------------------------------------------------------------
  21864. 465. opening unbound structure id in signature
  21865. Submitter: David Tarditi
  21866. Date: 7/19/91
  21867. Version: 0.70
  21868. Severity: minor
  21869. Problem: 
  21870.     The compiler falls over with the exception UnboundTable if you
  21871.     try to open an undefined structure in a signature.
  21872. Code: 
  21873.   signature S =
  21874.   sig
  21875.     open T (* T is undefined *)
  21876.   end
  21877. Status: fixed in 0.75
  21878. ---------------------------------------------------------------------------
  21879. 466. looping error message
  21880. Submitter:      Matti Jokinen, moj@utu.fi
  21881. Date:        22-Jun-1991
  21882. Version:        0.69, 0.70, possibly others
  21883. System:         probably all
  21884. Severity:       minor for an experienced user, but confusing to novices
  21885.  
  21886. Problem:        unterminating error message
  21887.  
  21888. Code:           fun f (p,q) =
  21889.             let fun g (p,q) = #1 q orelse f (p,q)
  21890.             in g (p, #2 q)
  21891.         end;
  21892.  
  21893. Transcript:    - fun f (p,q) =
  21894.         =     let fun g (p,q) = #1 q orelse f (p,q)
  21895.         =     in g (p, #2 q)
  21896.         = end;
  21897.         std_in:2.9-2.41 Error: unresolved flex record in let pattern
  21898.           type: {1:bool,...}
  21899.         std_in:1.1-4.3 Error: unresolved flex record in let pattern
  21900.           type: {1:bool,2:{1:bool,2:{1:bool,2:{1:bool,2:{1:bool,2:{1
  21901.         :bool,2:{1:bool,2:{1:bool,2:{1:bool,2:{1:bool,2:{1:bool,2:{1
  21902.         :bool,2:{1:bool,2:{1:bool,2:{1:bool,2:{1:bool,2:{1:bool,2:{1
  21903.         :bool,2:{1:bool,2:{1:bool,2:{1:bool,2:{1:bool,2:{1:bool,2:{1
  21904.         - - -
  21905.  
  21906. Comments:    Can be interrupted with ^c.
  21907. Status: fixed in 0.80
  21908. ---------------------------------------------------------------------------
  21909. 467. missing newline in declaration echo
  21910. Submitter:      Matti Jokinen (moj@utu.fi)
  21911. Date:        23-Jul-1991
  21912. Version:        0.69, 0.70, possibly others
  21913. System:         all
  21914. Severity:       minor
  21915.  
  21916. Problem:        Fixity declarations are echoed without newlines.
  21917.  
  21918. Code:           infix L; infixr R; nonfix N;
  21919.  
  21920. Transcript:    - infix L; infixr R; nonfix N;
  21921.         infix Linfixr Rnonfix N-
  21922.                        ^
  21923.                        This is the next prompt.
  21924.  
  21925. Fix:        Add `newline()' at the end of the printFixity function
  21926.         defined in src/print/printdec.sml:
  21927.  
  21928. *** printdec.sml.orig   Thu Mar 14 17:50:22 1991
  21929. --- printdec.sml        Mon Jul 22 04:11:27 1991
  21930. ***************
  21931. *** 215,227 ****
  21932.         and printFixity{fixity,ops} =
  21933.             (case fixity of
  21934.                NONfix => print "nonfix "
  21935.              | INfix (i,_) =>
  21936.                  (if i mod 2 = 0 then
  21937.                     print "infix "
  21938.                   else print "infixr ";
  21939.                   if i div 2 > 0 then
  21940.                     (print (i div 2);
  21941.                      print " ")
  21942.                   else ());
  21943. !            printSequence " " printSym ops)
  21944.  
  21945. --- 215,228 ----
  21946.         and printFixity{fixity,ops} =
  21947.             (case fixity of
  21948.                NONfix => print "nonfix "
  21949.              | INfix (i,_) =>
  21950.                  (if i mod 2 = 0 then
  21951.                     print "infix "
  21952.                   else print "infixr ";
  21953.                   if i div 2 > 0 then
  21954.                     (print (i div 2);
  21955.                      print " ")
  21956.                   else ());
  21957. !            printSequence " " printSym ops;
  21958. !            newline())
  21959.  
  21960. Status: fixed in 0.75
  21961. ---------------------------------------------------------------------------
  21962. 468. extra comma in printing unit record
  21963. Submitter: Thomas Yan (Cornell)
  21964. Date: 11/18/91
  21965. Version: 0.75
  21966. Severity: minor
  21967. Problem: 
  21968.   Extra comma in printing unit record:
  21969. Transcript: 
  21970.   - val {...} = ();
  21971.   std_in:2.1-2.14 Warning: binding contains no variables
  21972.           {,...} = ...
  21973. Status: fixed in 0.85
  21974. ---------------------------------------------------------------------------
  21975. 469. infix precedence bound
  21976. Submitter: Thomas Yan (Cornell)
  21977. Date: 11/18/91
  21978. Version: 0.75
  21979. Severity: minor
  21980. Problem: 
  21981.   Infix declaration allows values greater than 9:
  21982. Transcript: 
  21983.   - infix 10 +;
  21984.   infix 10 +
  21985. Status: fixed in 0.90
  21986. ---------------------------------------------------------------------------
  21987. 470. top-level continuations
  21988. Submitter:    Francis.Dupont@inria.fr
  21989. Date:        Sat Nov 23 16:49:36 MET 1991
  21990. Version:    0.75
  21991. System:        all systems (tested on Sun4/75 running SunOS4.1.1)
  21992. Severity:    major
  21993. Problem:    the typing of toplevel continuation is incorrect
  21994. Code:        see later
  21995. Transcript:    see later
  21996. Comments:    this bug cannot be corrected because toplevel continuations
  21997.         (implied by call/cc) are not compatible with SML type system
  21998.         (see all the literature on this topics, for intance my
  21999.         PhD thesis if you can read French...)
  22000. Fix:        Easy : drop call/cc (use limited static continuations)
  22001.  
  22002. The code and the bug :
  22003.  
  22004. % sml
  22005. Standard ML of New Jersey, Version 75, November 11, 1991
  22006. Arrays have changed; see Release Notes
  22007. val it = () : unit
  22008. - datatype foo = None | Kont of int cont;
  22009. datatype  foo
  22010. con Kont : int cont -> foo
  22011. con None : foo
  22012. - val x = ref None;
  22013. val x = ref None : foo ref
  22014. - callcc (fn k => (x := Kont k; 1));
  22015. val it = 1 : int
  22016. - val y = (fn (Kont k) => k) (!x);
  22017. std_in:5.10-5.25 Warning: match not exhaustive
  22018.         Kont k => ...
  22019. val y = cont : int cont
  22020. - val f = (throw y : int -> bool);
  22021. val f = fn : int -> bool
  22022. - f 1;
  22023. val it = 1 : int
  22024.  
  22025. Francis.Dupont@inria.fr
  22026.  
  22027. PS : a variant of this bug is described in report 145 "stale top-level
  22028. continuations cause type bugs" (cf doc/bugs/masterbugs) and its status
  22029. is "fixed in 0.49" (sorry, it cannot be fixed) !
  22030.  
  22031. Status: fixed in 0.82 (but further investigation is warranted)
  22032. ---------------------------------------------------------------------------
  22033. 471. allocating large arrays
  22034. Submitter: Mike Crawley <mjc@abstract-hardware-ltd.co.uk>
  22035. Date: 11/26/91
  22036. Version: 0.75
  22037. Severity: serious
  22038. Problem: 
  22039.   Sometimes it will crash when allocating very large arrays.
  22040. Transcript: 
  22041.      Standard ML of New Jersey, Version 75, November 11, 1991
  22042.      Arrays have changed; see Release Notes
  22043.      val it = () : unit
  22044.      - open Array;
  22045.      open Array
  22046.      - infix 7 sub;
  22047.      infix 7 sub
  22048.      - fun Sieve n =
  22049.      let
  22050.        val A = array (n,false) ;
  22051.  
  22052.        fun set i di = if i < n then (update (A,i,true) ; set (i+di) di ) else () ;
  22053.  
  22054.        fun get 1 acc = acc
  22055.        |   get i acc = get (i-1) (if A sub i then acc else i :: acc) ;
  22056.  
  22057.        fun siv i = if i >= n then [] else
  22058.            if (A sub i) = false then (set (i+i) i ; siv (i+1))
  22059.            else siv (i+1) ;
  22060.      in
  22061.        siv 2 ; get (n-1) []
  22062.      end ;
  22063.      val Sieve = fn : int -> int list
  22064.      - Sieve 3628800;
  22065.   Segmentation fault (core dumped)
  22066.  
  22067.   But it works if I do it more gently.
  22068.  
  22069.   Standard ML of New Jersey, Version 75, November 11, 1991
  22070.   Arrays have changed; see Release Notes
  22071.   val it = () : unit
  22072.   - open Array;
  22073.   open Array
  22074.   - infix 7 sub;
  22075.   infix 7 sub
  22076.   - fun Sieve n =
  22077.   let
  22078.     val A = array (n,false) ;
  22079.  
  22080.     fun set i di = if i < n then (update (A,i,true) ; set (i+di) di ) else () ;
  22081.  
  22082.     fun get 1 acc = acc
  22083.     |   get i acc = get (i-1) (if A sub i then acc else i :: acc) ;
  22084.  
  22085.     fun siv i = if i >= n then [] else
  22086.         if (A sub i) = false then (set (i+i) i ; siv (i+1))
  22087.         else siv (i+1) ;
  22088.   in
  22089.     siv 2 ; get (n-1) []
  22090.   end ;
  22091.   val Sieve = fn : int -> int list
  22092.   - Sieve 1000000;
  22093.  
  22094.   [Increasing heap to 2952k]
  22095.  
  22096.   [Increasing heap to 5792k]
  22097.  
  22098.   [Increasing heap to 8192k]
  22099.  
  22100.   [Major collection... 63% used (412372/652688), 250 msec]
  22101.  
  22102.   [Increasing heap to 12544k]
  22103.   val it = [2,3,5,7,11,13,17,19,23,29,31,37,...] : int list
  22104.   - Sieve 3628800;
  22105.  
  22106.   [Major collection... 25% used (1354396/5356616), 880 msec]
  22107.  
  22108.   [Increasing heap to 14944k]
  22109.  
  22110.   [Major collection... 99% used (1354396/1354396), 870 msec]
  22111.  
  22112.   [Increasing heap to 24408k]
  22113.  
  22114.   [Major collection... 99% used (1354396/1354396), 860 msec]
  22115.  
  22116.   [Increasing heap to 38600k]
  22117.  
  22118.   [Increasing heap to 42544k]
  22119.   val it = [2,3,5,7,11,13,17,19,23,29,31,37,...] : int list
  22120.   - 
  22121. Comments:
  22122.   This occurs in
  22123.      Standard ML of New Jersey, Version 75, November 11, 1991
  22124.      Standard ML of New Jersey, Version 0.73, 10 September 1991
  22125.      Standard ML of New Jersey, Version 0.66, 15 September 1990
  22126.   so I think it is the memory allocation rather than the new Array structure.
  22127. Status: fixed in 0.84
  22128. ---------------------------------------------------------------------------
  22129. 472. growing heap
  22130. Submitter: Simon Finn <simon@abstract-hardware-ltd.co.uk>
  22131. Date: 11/26/91
  22132. Version: 0.75
  22133. System: ?
  22134. Severity: serious 
  22135. Problem: 
  22136.   SML/NJ version 0.75 seems to have a problem when asked to grow
  22137.   the heap by a large factor.
  22138. Transcript: 
  22139.  this works:
  22140.   Perky%  /ml/njml/mlsave.75/src/sml
  22141.   Standard ML of New Jersey, Version 75, November 11, 1991
  22142.   Arrays have changed; see Release Notes
  22143.   val it = () : unit
  22144.   - val y = Array.array (1000000,true);
  22145.  
  22146.   [Increasing heap to 4020k]
  22147.  
  22148.   [Increasing heap to 8192k]
  22149.  
  22150.   [Major collection... 98% used (409232/414048), 260 msec]
  22151.  
  22152.   [Increasing heap to 12884k]
  22153.   val y = prim? : bool array
  22154.   - val x = Array.array (2000000,true);
  22155.  
  22156.   [Increasing heap to 16636k]
  22157.  
  22158.   [Major collection... 99% used (4409484/4411876), 1770 msec]
  22159.  
  22160.   [Increasing heap to 31412k]
  22161.   val x = prim? : bool array
  22162.  
  22163.  but this doesn't:
  22164.  
  22165.   - Perky% !!
  22166.   /ml/njml/mlsave.75/src/sml
  22167.   Standard ML of New Jersey, Version 75, November 11, 1991
  22168.   Arrays have changed; see Release Notes
  22169.   val it = () : unit
  22170.   - val x = Array.array (2000000,true);
  22171.   Segmentation fault (core dumped)
  22172.   Perky% 
  22173.  
  22174. Status: fixed in 0.84
  22175. ---------------------------------------------------------------------------
  22176. 473. inadequate error message
  22177. Submitter: George Otto (ptah!otto)
  22178. Date: 11/27/91
  22179. Version: 0.75?
  22180. Severity: minor
  22181. Problem: 
  22182.   I put some ML datatype definitions into a file and then brought them into ML
  22183.   using the command
  22184.  
  22185.       use "file";
  22186.  
  22187.   I got back the error message "duplicate constructor" with no other
  22188.   information.  Couldn't this be more helpful and mention the name of the
  22189.   constructor it is reporting about?
  22190. Status: fixed in 0.91 (dbm)
  22191. ---------------------------------------------------------------------------
  22192. 474. compiler bug: patType -- unexpected pattern
  22193. Submitter: John Reppy
  22194. Date: 12/6/91
  22195. Version: 0.75
  22196. Severity: minor
  22197. Problem: 
  22198.   Compiler bug: patType -- unexpected pattern
  22199. Code: 
  22200.     (* extract the draw_cmd, id and depth of a drawable *)
  22201.       fun infoOfDrawable (DRAWABLE{draw_cmd, DWIN w}) = let
  22202.         val WIN{id, scr_depth=SCRDEPTH{depth, ...}, ...} = w
  22203.         in
  22204.           {draw_cmd=draw_cmd, id=id, depth=depth}
  22205.         end
  22206.     | infoOfDrawable (DRAWABLE{draw_cmd, DPM pm}) = let
  22207.         val PM{id, scr_depth=SCRDEPTH{depth, ...}, ...} = pm
  22208.         in
  22209.           {draw_cmd=draw_cmd, id=id, depth=depth}
  22210.         end
  22211. Transcript: 
  22212.   window/draw.sml:16.51 Error: syntax error: inserting AS
  22213.   window/draw.sml:21.43-21.44 Error: syntax error: inserting AS
  22214.   Error: Compiler bug: patType -- unexpected pattern
  22215. Comments: couldn't isolate small example (same as #515)
  22216. Status: fixed in 0.83
  22217. ---------------------------------------------------------------------------
  22218. 475. LOOKUP exception from mllex (see also 510, 516)
  22219. Submitter:      Markus Freericks, mfx@cs.tu-berlin.de
  22220. Date:        12.12.91
  22221. Version:        Standard ML of New Jersey, Version 75, November 11, 1991
  22222. System:         Sparc
  22223. Severity:       quite minor        
  22224. Problem:        
  22225. When I use a regular expression that isn't defined, I get an unhelpful
  22226. exception LOOKUP. This exception is not mentioned in lexgen.doc, and
  22227. there is no indication as to where the problem occurs in the input
  22228. file.
  22229. Code:           
  22230.  
  22231. (* bug *)
  22232. %%
  22233. %%
  22234. {xxx}    => {()};
  22235.  
  22236. Transcript:
  22237.  
  22238.     mfx@marx [77]% sml-lex bug
  22239.     ? sml-lex: uncaught exception LOOKUP
  22240. or
  22241.  
  22242. - use "lexgen.sml";
  22243. [opening lexgen.sml]
  22244. lexgen.sml:1127.5-1131.57 Warning: match not exhaustive
  22245.         (true,129) => ...
  22246.         (true,256) => ...
  22247.         (false,129) => ...
  22248.         (false,256) => ...
  22249. lexgen.sml:876.2-895.10 Warning: match not exhaustive
  22250.         (nil,nil) => ...
  22251.         (a :: a',b :: b') => ...
  22252. lexgen.sml:854.19-855.48 Warning: match not exhaustive
  22253.         1 => ...
  22254.         2 => ...
  22255.         3 => ...
  22256. lexgen.sml:813.9-813.55 Warning: match not exhaustive
  22257.         (tl,el) :: r => ...
  22258. functor RedBlack : <sig>
  22259. signature LEXGEN = 
  22260.   sig
  22261.     val lexGen : string -> unit
  22262.   end
  22263. structure LexGen : LEXGEN
  22264. [closing lexgen.sml]
  22265. val it = () : unit
  22266.  
  22267. - LexGen.lexGen "bug";
  22268.  
  22269. uncaught exception LOOKUP
  22270.  
  22271. Comments:
  22272. Being what could be called a 'naive user', I first thought my
  22273. installation of SML and/or lexgen.sml to be in error. The warnings
  22274. encountered when loading lexgen.sml added to this impression.
  22275.  
  22276. Fix:
  22277. A change to the doc should be enough; the error in the input file is
  22278. easy enough to find when one knows what to search for.
  22279. Status: fixed in 0.91 (Tarditi)
  22280. ---------------------------------------------------------------------------
  22281. 476. sml-lex
  22282. Submitter: Denys Duchier <dduchier@csi.UOttawa.CA>
  22283. Date: 12/11/91
  22284. Version: 0.75
  22285. Severity: minor
  22286. Problem: 
  22287.   sml-lex (with SML V75) produces a lexer that contains D and T states
  22288.   when I use the special character $.  Here is the source:
  22289. Code: 
  22290.  
  22291.     datatype lexresult = EOF;
  22292.     fun eof () = EOF;
  22293.     %%
  22294.     %%
  22295.     ";".*$    => (lex());
  22296.  
  22297. Comments: the rule is meant to parse a lisp-style comment.
  22298.   Andrew sez:  I'm not sure that this is really a bug.  Perhaps the
  22299.   documentation needs to be changed?
  22300. Status: fixed  in 0.91 (Tarditi)
  22301. ---------------------------------------------------------------------------
  22302. 477. duplicate specifications through include
  22303. Submitter: Nick Rothwell
  22304. Date: 21 Oct 91
  22305. Version: 0.73
  22306. Severity: minor
  22307. Problem: 
  22308.     I enclose a short-ish (40 line) program. It compiles under poplog and one
  22309.     version of poly. It fails under another version of poly and with different
  22310.     errors under two versions of SML/NJ. By my reckoning, the program is legal
  22311.     SML.
  22312. Code: 
  22313.   signature MONO_SET =
  22314.     sig
  22315.       type Element
  22316.       type Set
  22317.       type T sharing type T = Set
  22318.     end;
  22319.  
  22320.   functor MonoSet(type T): MONO_SET =
  22321.     struct
  22322.       abstype Set = Set of T list
  22323.       with
  22324.     type Element = T
  22325.     type T = Set
  22326.       end
  22327.     end;
  22328.  
  22329.   signature INPUT_VAR =
  22330.     sig
  22331.       type InputVar
  22332.       type InputVarSet
  22333.  
  22334.       include MONO_SET sharing type Element = InputVar
  22335.                and type Set = InputVarSet
  22336.  
  22337.       type T sharing type T = InputVar
  22338.     end;
  22339.  
  22340.   functor InputVar(): INPUT_VAR =
  22341.     struct
  22342.       datatype InputVar = INPUT_VAR of string
  22343.  
  22344.       local
  22345.     structure S = MonoSet(type T = InputVar)
  22346.       in
  22347.     open S
  22348.     type InputVarSet = Set
  22349.       end
  22350.  
  22351.       type T = InputVar
  22352.     end;
  22353.  
  22354. Transcript: 
  22355.   X.sml:25.10 Error: duplicate specifications for type constructor T in signature
  22356. Comments: a deliberate divergence from the Definition.
  22357. Status: not a bug
  22358. ----------------------------------------------------------------------
  22359. 478. order of type definitions in withtype clause
  22360. Submitter: Andrew Appel
  22361. Date: 10/11/91
  22362. Version: 0.73
  22363. Severity: minor
  22364. Problem: 
  22365.   Type definitions in withtype clause have to be ordered properly.
  22366. Code: 
  22367.     datatype foo = T 
  22368.       withtype a = b and b = foo
  22369. Comments:
  22370.   I think this is correct.  Have to check Definition.
  22371. Status: not a bug
  22372. ----------------------------------------------------------------------
  22373. 479. Boxity exception in vector_n
  22374. Submitter: Andrew Koenig
  22375. Date: 10/22/91
  22376. Version: ?
  22377. Severity: major
  22378. Problem: 
  22379.   Applying vector_n with index out of bounds yields Boxity exception.
  22380. Transcript: 
  22381.     - open Vector;
  22382.     open Vector
  22383.     - infix 9 sub;
  22384.     infix 9 sub
  22385.     - val x = vector_n(10,[1,2,3]);
  22386.     val x = - : int vector
  22387.     - length(x);
  22388.     val it = 10 : int
  22389.     - x sub 0;
  22390.     val it = 1 : int
  22391.     - x sub 1;
  22392.     val it = 2 : int
  22393.     - x sub 2;
  22394.     val it = 3 : int
  22395.     - x sub 3;
  22396.     val it = 8 : int
  22397.     - x sub 4;
  22398.     val it = 
  22399.     uncaught exception Boxity
  22400. Comments:
  22401.   vector_n was not supposed to be exported.
  22402. Status: fixed in 0.75
  22403. ----------------------------------------------------------------------
  22404. 480. Exit status of makeml is 1.
  22405. Submitter: David Tarditi
  22406. Date: 10/23/91
  22407. Version: 0.75?
  22408. Severity: minor
  22409. Problem: 
  22410.     makeml almost always returns an exit status of 1, which
  22411.     indicates failure.   This is because as a shell program it
  22412.     returns the value of its last command, which is an if-statement
  22413.     that almost always "fails" (the value of the if-statement is
  22414.     the last simple command that it executes, which is a test that
  22415.     fails; there is no "else" clause to execute).
  22416.  
  22417.     This creates problems for me when I use a makefile that invokes
  22418.     makeml to build sml images.  Could you make the last statement
  22419.     in makeml "exit 0" ?
  22420. Comments:
  22421. Status: fixed in 0.89
  22422. ----------------------------------------------------------------------
  22423. 481. redeclared constructors
  22424. Submitter: Mike Crawley <mjc@abstract-hardware-ltd.co.uk>
  22425. Date: 10/28/91
  22426. Version: 0.73
  22427. Severity: minor
  22428. Problem: 
  22429.     SML/NJ 0.73 does not accept the following valid ML program
  22430. Code: 
  22431.     signature S = sig
  22432.       datatype a = A | B of string ;
  22433.       datatype b = B | C ;
  22434.     end ;
  22435.  
  22436.     functor F(S:S) =
  22437.     struct
  22438.       open S ;
  22439.  
  22440.       fun matchA A = true
  22441.       |   matchA _ = false ;
  22442.  
  22443.       fun matchB B = true
  22444.       |   matchB _ = false ;
  22445.  
  22446.       fun matchC C = true
  22447.       |   matchC _ = false ;
  22448.     end ;
  22449.  
  22450.     structure S = F ( datatype a = A | B of string ;
  22451.               datatype b = B | C ) ;
  22452.  
  22453. Status: open
  22454. ----------------------------------------------------------------------
  22455. 482. "constant" unary type abbreviations in signature matching
  22456. Submitter: Mike Crawley <mjc@abstract-hardware-ltd.co.uk>
  22457. Date: 10/28/91
  22458. Version: 0.73
  22459. Severity: significant
  22460. Problem: 
  22461.    Poly/ML allows this; SML/NJ 0.73 doesn't
  22462.    It all depends whether or not you expand the type-abbreviation t
  22463.    when you match the datatype d.
  22464. Code: 
  22465.     signature A =
  22466.     sig
  22467.       eqtype 'a t
  22468.       datatype d = C | D of int t
  22469.     end;
  22470.  
  22471.     structure Z =
  22472.     struct
  22473.       type 'a t = bool
  22474.       datatype d = C | D of bool t
  22475.     end;
  22476.  
  22477.     structure X : A = Z;
  22478. Status: fixed at least as early as 0.80
  22479. ----------------------------------------------------------------------
  22480. 483. lexgen compilation blowup
  22481. Submitter:    Lie Ma, ma@cs.pdx.edu
  22482. Date:        10/29/1991
  22483. Version:    SML Ver.0.66
  22484. System:        Sun Sparc
  22485. Code:        lexgen.sml Ver. 1.3, Dec'89
  22486. Encl:        typescript
  22487. Problem:    
  22488.     
  22489.     I'm using lexgen to write a lexer for a formal specification language.
  22490.     According to the manual, I should use lexgen.sml in the following way:
  22491.  
  22492.     quote: 
  22493.         Running ML-Lex
  22494.         Use "lexgen.sml"; this will create a structre LexGen. 
  22495.         The function LexGen.lexGen creates a program for a
  22496.         lexer from an input specification. It takes a string
  22497.         argument -- the name of the file containing the input
  22498.         spacification. The output file name is determined by
  22499.         appending ".sml" to the input file name.
  22500.     end{quote}
  22501.  
  22502.     I got the extremly poor performance when I tried to use "lexgen.sml".
  22503.     I tried on two Suns, both taking appr. 25 to 28 minutes to evaluate
  22504.     "lexgen.sml". The maximum heap was about 16 MB. The process was so 
  22505.     huge that the system speeded donw and I had to kill it in most cases.
  22506.     And once other user even could not run latex within emacs.
  22507.  
  22508.     I want to know whether it is usual. If not, it's caused by ML or 
  22509.     "lexgen.sml"?
  22510.  
  22511.     Thank you to your attention to this. Your prompt reply will be 
  22512.     appreciated.
  22513. Status: fixed in 0.89
  22514. ----------------------------------------------------------------------
  22515. 484. interrupt is buggy (same as 511, 518)
  22516. Submitter: Mike Crawley
  22517. Date: 10/29/91
  22518. Version: 0.73
  22519. System: Sparc/SunOS
  22520. Severity: major
  22521. Problem: 
  22522.   I have been able to repeat the following
  22523.   bug a number of times. Pressing ^C to interrupt
  22524.   sml while it is busy can sometimes crash it.
  22525.   The saved image I was using was 10MB at the time.
  22526.   
  22527.   ^C
  22528.   SIGEMT not related to gc (bogus test: 0x9de3bfc0 @ 0x9dd8)
  22529.   
  22530. Transcript: 
  22531. Comments:
  22532.     This is a very mysterious bug that has been around for a while.  The
  22533.     "0x9de3bfc0 @ 0x9dd8" means that the signal handler received a SIGEMT
  22534.     signal with the PC = 0x9dd8 and the instruction at that address being
  22535.     "save %sp,-0x40,%sp."  Under my reading of the documentation, this
  22536.     should never occur in SunOS.  The address 0x9dd8 is interesting, since
  22537.     it is the address of an assembly routine used to force a GC trap
  22538.     after a signal (such as ^C), but I don't understand how the sigcontext
  22539.     program counter gets that value.  [John Reppy]
  22540. Status: open
  22541. ----------------------------------------------------------------------
  22542. 485. structure manipulation bombs
  22543. Submitter:      Tim Freeman <tsf@cs.cmu.edu>
  22544. Date:        Thu Oct 31 15:32:46 1991
  22545. Version:        0.74
  22546. System:         Sun 4 running some version of Mach
  22547. Severity:       minor
  22548. Problem:        With some manipulations of structures, raising
  22549.         unhandled exceptions causes SML to bomb.
  22550. Code:           bug3.sml contains:
  22551.         structure Util = 
  22552.             struct
  22553.             exception Bug of string
  22554.             end
  22555.         
  22556.         structure InstProto = 
  22557.         struct
  22558.             structure U = Util
  22559.             structure S = struct end 
  22560.         end 
  22561.         
  22562.         open InstProto
  22563.         ;
  22564.         raise U.Bug "hi"
  22565.  
  22566. Transcript:     % sml
  22567.         Standard ML of New Jersey, Version 0.74, 10 October, 1991
  22568.         Prerelease version.  Arrays have changed; see doc/NEWS
  22569.         val it = () : unit
  22570.         - use "bug3.sml";
  22571.         [opening bug3.sml]
  22572.         structure Util : 
  22573.           sig
  22574.             exception Bug of string
  22575.           end
  22576.         structure InstProto : 
  22577.           sig
  22578.             structure S : ...
  22579.             structure U : ...
  22580.           end
  22581.         open InstProto
  22582.         SIGILL code 0x7
  22583.         %                 
  22584. Comments:    Earlier during the process of narrowing down this bug,
  22585.         it was saying 
  22586.  
  22587.             uncaught exception random binary garbage
  22588.  
  22589.         (except you have to imagine the string "random binary
  22590.         garbage" replaced by random binary garbage) instead of
  22591.         getting the SIGILL trap. 
  22592.  
  22593. Status: fixed in 0.84
  22594. ----------------------------------------------------------------------
  22595. 486. Regbind exception (same as bug 380?)
  22596. Submitter:      jont@harlqn.co.uk
  22597. Date:           31/10/91
  22598. Version:        SML of NJ version number, 0.66
  22599. System:         Sun 4/330 with SunOS 4.1.1
  22600. Severity:       critical
  22601. Problem:        The code generation phase blows up with an uncaught
  22602.         exception Regbind
  22603. Code:           
  22604. (* _testreals.sml the functor (used to be) *)
  22605. (*
  22606. Copyright (c) 1991 Harlequin Ltd.
  22607. *)
  22608.  
  22609.   fun div2 _ =
  22610.     let
  22611.       val new_y = if 0 mod 2 = 0 then "0" else chr(ord "0" + 1)
  22612.     in
  22613.       div2 []
  22614.     end
  22615.  
  22616. Transcript:
  22617. sml66
  22618. Standard ML of New Jersey, Version 0.66, 15 September 1990
  22619. val it = () : unit
  22620. - use"../main/_testreals.sml";
  22621. [opening ../main/_testreals.sml]
  22622. [closing ../main/_testreals.sml]
  22623.  
  22624. uncaught exception Regbind
  22625.  
  22626. Comments: This is the second time I have encountered this problem. The
  22627. first time I was unable to produce a small example, and it later went
  22628. away for reasons which were never clear. However, this time it cropped
  22629. up in a functor which was only 80 lines at the time, and I was able to
  22630. whittle it down to the above rather useless function.
  22631.  
  22632. Probably same as bug #380.
  22633. Status: fixed in 0.84
  22634. ----------------------------------------------------------------------
  22635. 487. clumsy memory exhaustion
  22636. Submitter: Andy Koenig
  22637. Date: 11/7/91
  22638. Version: 0.74
  22639. System: Sparc
  22640. Severity: minor 
  22641. Problem: 
  22642.    SML-NJ is not very nice about handling memory exhaustion.
  22643. Transcript: 
  22644.  
  22645.     [boojum] sml
  22646.     Standard ML of New Jersey, Version 0.74, 10 October, 1991
  22647.     Prerelease version.  Arrays have changed; see doc/NEWS
  22648.     val it = () : unit
  22649.     - fun f x = f(0::x);
  22650.     val f = fn : int list -> 'a
  22651.     - f nil;
  22652.  
  22653.     [Increasing heap to 3164k]
  22654.  
  22655.     [Increasing heap to 4452k]
  22656.  
  22657.     [Increasing heap to 5456k]
  22658.  
  22659.     [Major collection...
  22660.     [Increasing heap to 8192k]
  22661.      76% used (3427160/4508104), 2610 msec]
  22662.  
  22663.     [Increasing heap to 13192k]
  22664.  
  22665.     [Major collection... 49% used (4497848/8999168), 4600 msec]
  22666.  
  22667.     [Increasing heap to 26380k]
  22668.  
  22669.     [Major collection... 49% used (8999168/18002072), 9250 msec]
  22670.  
  22671.     [Increasing heap to 27204k]
  22672.  
  22673.     [Major collection...
  22674.     [Increasing heap to 27620k]
  22675.  
  22676.     [Increasing heap to 27776k]
  22677.  
  22678.     [Increasing heap to 27860k]
  22679.  
  22680.     [Increasing heap to 27880k]
  22681.  
  22682.     Warning: can't increase heap
  22683.  
  22684.     Ran out of memory[boojum] 
  22685. Comments:
  22686.  
  22687. While I do ultimately expect some kind of drastic termination,
  22688. I do **NOT** expect to be unceremoniously dumped out of ML back
  22689. into the Shell.  A more reasonable strategy might be to preallocate
  22690. a chunk of memory to be used as secondary storage while recovering
  22691. from exhaustion of primary storage.  That, at least, would allow
  22692. for a return to top level and associated garbage collection, which,
  22693. in many cases, would allow interactive execution to resume.
  22694.  
  22695. Incidentally, this example was run on a Sparcstation with 64
  22696. megabytes of physical memory and no limit on process size
  22697. that I know of.  I don't know why it gave up the ghost at
  22698. 28 megabytes -- do you?
  22699.  
  22700. Status: open
  22701. ----------------------------------------------------------------------
  22702. 488. wrong types in pervasives
  22703. Submitter: Thomas Yan
  22704. Date: 8/21/91
  22705. Version: 0.71
  22706. Severity: minor
  22707. Problem: 
  22708.   bugs in the pervasive environment
  22709. Transcript: 
  22710.   Standard ML of New Jersey, Version 0.71, 23 July 1991
  22711.   val it = () : unit
  22712.   - Array.tabulate;
  22713.   val it = fn : 'a * (int -> '1b) -> '1b array
  22714.   - String.chr;
  22715.   val it = fn : int -> 'a
  22716.   - 
  22717. Status: Fixed in 0.75
  22718. ----------------------------------------------------------------------
  22719. 489. exportFn image size too large
  22720. Submitter: Andy Koenig
  22721. Date: 11/17/91
  22722. Version: 0.75
  22723. System: Sparc
  22724. Severity: significant
  22725. Problem: 
  22726.     On a Sparc, here's the text and data space used by the executable
  22727.     produced by the following program (with an ML build with noshare):
  22728.  
  22729.         exportFn ("a.out", fn _ => print "Hello world\n");
  22730.  
  22731.     Version        text    data
  22732.  
  22733.     0.66        57344    188416
  22734.     pre-74        81920    425984
  22735.     75            81920    294912
  22736.  
  22737.     Evidently some of the memory leaks in 0.66 have been fixed but not all.
  22738.  
  22739.     Anoither example from John Reppy:
  22740.     (sml-export was made with the -pervshare option)
  22741.  
  22742.     <jhr@bat> sml-export
  22743.     Standard ML of New Jersey, Version 0.89, September 4, 1992
  22744.     val it = () : unit
  22745.     - exportFn("foo", fn _ => ());
  22746.  
  22747.     [Major collection... 25% used (842428/3366736), 430 msec]
  22748.  
  22749.     [Major collection... 66% used (560264/844136), 310 msec]
  22750.     <jhr@bat> size foo
  22751.     text    data    bss     dec     hex
  22752.     241664  614400  0       856064  d1000
  22753.     <jhr@bat> size sml-export
  22754.     text    data    bss     dec     hex
  22755.     241664  3416064 0       3657728 37d000
  22756.  
  22757. Fix:
  22758.   Environment refs (pervasiveEnvRef, topLevelEnvRef) were added to
  22759.   Hooks and cleared on export.  Changed files boot/perv.sml and
  22760.   boot/system.sig.
  22761. Status: fixed in 0.93c (awa,dbm)
  22762. ----------------------------------------------------------------------
  22763. 490. function has bad type in pervasives
  22764. Submitter: Lal Geoge
  22765. Date: 11/20/91
  22766. Version: 0.75
  22767. Severity: significant
  22768. Problem: 
  22769.   ceiling has wrong type
  22770. Transcript: 
  22771.     Standard ML of New Jersey, Version 75, November 11, 1991
  22772.     Arrays have changed; see Release Notes
  22773.     - ceiling;
  22774.     val it = fn : real -> 'a
  22775.     -
  22776. Status: fixed in 0.76
  22777. ----------------------------------------------------------------------
  22778. 491. memory leak
  22779. Submitter:      Nevin Heintze (nch@cs.cmu.edu)
  22780. Date:          Wed Nov 20 1991
  22781. Version:        0.75
  22782. System:         sparc1, pmax, sun3
  22783.         Mach 2.6 #5.1(CS8f): Wed Sep 11 14:39:14 EDT 1991; CS8/STD+WS
  22784. Severity:       major
  22785. Problem:        garbage collection when rebuilding structures
  22786.         (stuff in old structures does not seem to be reclaimed).
  22787. Code:           
  22788.  
  22789. signature MEM_HOG =
  22790.   sig
  22791.     val X : int Array.array
  22792.   end
  22793.  
  22794. functor Mem_hog() : MEM_HOG =
  22795. struct
  22796.     val X = Array.array(200000, 42) 
  22797.   end
  22798.  
  22799. structure Mem_hog : MEM_HOG = Mem_hog();
  22800. open Mem_hog;
  22801.  
  22802. structure Mem_hog : MEM_HOG = Mem_hog();
  22803. open Mem_hog;
  22804.  
  22805. (* etc...  (Following transcript uses 8 functor applications) *)
  22806.  
  22807. Transcript:   
  22808.  
  22809. Script started on Wed Nov 20 13:54:15 1991
  22810. [alonzo] % sml
  22811. Standard ML of New Jersey, Version 75, November 11, 1991
  22812. Arrays have changed; see Release Notes
  22813. val it = () : unit
  22814. - use "mem.sml";
  22815. [opening mem.sml]
  22816.  
  22817. [Increasing heap to 3174k]
  22818. signature MEM_HOG = 
  22819.   sig
  22820.     val X : int array
  22821.   end
  22822. functor Mem_hog : <sig>
  22823. structure Mem_hog : MEM_HOG
  22824. open Mem_hog
  22825.  
  22826. [Increasing heap to 3990k]
  22827. structure Mem_hog : MEM_HOG
  22828.  
  22829. [Increasing heap to 4094k]
  22830. open Mem_hog
  22831. structure Mem_hog : MEM_HOG
  22832. open Mem_hog
  22833.  
  22834. [Major collection...
  22835. [Increasing heap to 6486k]
  22836.  98% used (2814944/2866068), 1930 msec]
  22837.  
  22838. [Increasing heap to 10022k]
  22839. structure Mem_hog : MEM_HOG
  22840. open Mem_hog
  22841. structure Mem_hog : MEM_HOG
  22842. open Mem_hog
  22843. structure Mem_hog : MEM_HOG
  22844. open Mem_hog
  22845. structure Mem_hog : MEM_HOG
  22846.  
  22847. [Major collection...
  22848. [Increasing heap to 17126k]
  22849.  73% used (4412384/6025784), 3670 msec]
  22850.  
  22851. [Increasing heap to 17646k]
  22852. open Mem_hog
  22853. structure Mem_hog : MEM_HOG
  22854. open Mem_hog
  22855. [closing mem.sml]
  22856. val it = () : unit
  22857. -
  22858. [alonzo] % exit
  22859. script done on Wed Nov 20 13:54:43 1991
  22860.  
  22861. Comments:
  22862.   I have been running into this problem for a while now in 
  22863.   some program analysis implementation work, but was not sure where
  22864.   the problem was.  After about 3-4 rebuilds of my system I usually
  22865.   have to start another core image.  
  22866.  
  22867.   The general problem occurs on sparc, sun4 and pmax machines;
  22868.   the specific code given above has been tried on a sparc (24MB) and a
  22869.   pmax (64MB?).  If the "open Mem_hog" is removed, then the problem goes
  22870.   away.  The problem is not specific to arrays; for example if X is
  22871.   bound to a list of a couple of thousand elements instead of an array,
  22872.   then similar behaviour occurs.
  22873. Status: fixed in 0.89
  22874. ----------------------------------------------------------------------
  22875. 492. compiler bug from sharing
  22876. Submitter: David Tarditi
  22877. Date: 7/19/91
  22878. Version: 0.70
  22879. Severity: major
  22880. Problem: 
  22881.     This code causes a compiler bug in version 0.70.  It should be
  22882.     an interesting test case in the future.
  22883. Code: 
  22884. (* This code shows that we'll need to augment structure instantiation
  22885.    arrays during functor abstraction to include structures which are
  22886.    not in the signature, but which have views that are in the
  22887.    signature.
  22888. *)
  22889.  
  22890. signature S0 = sig
  22891.              type u
  22892.            end
  22893.  
  22894. signature S1 = sig
  22895.              type t
  22896.              val v : t
  22897.            end
  22898.  
  22899. (* define a structure A, but export only views of A *)
  22900.  
  22901. functor F1() : sig
  22902.              structure B : S0
  22903.              structure C : S1
  22904.            end =
  22905.    struct
  22906.     structure A = struct
  22907.                       datatype u = U
  22908.                       datatype t = T
  22909.                       val v = T
  22910.                   end
  22911.         structure B : S0 = A
  22912.     structure C : S1 = A
  22913.    end
  22914.  
  22915. structure D = F1()
  22916.  
  22917. (* the definitional sharing constraint implies that C.t = D.C.t,
  22918.    but we won't know this unless we keep the origin of D.B around.*)
  22919.  
  22920. functor F2(A : sig 
  22921.             structure C : S1
  22922.             sharing D.B = C
  22923.            end) : sig
  22924.                   val v : A.C.t
  22925.                   end =
  22926.    struct
  22927.     val v = D.C.v
  22928.    end
  22929. Status: fixed in 0.84
  22930. ----------------------------------------------------------------------
  22931. 493. Compiler bugs from bad include specs
  22932. Submitter: Bruce Esrig
  22933. Date: 7/19/91
  22934. Version: ?
  22935. Severity: major
  22936. Problem: 
  22937.   Compiler bug from include specs
  22938. Code: 
  22939. (* Sigs.sml -- experiment with signatures and sharing *)
  22940.  
  22941. (* this is accepted *)
  22942. signature X' = sig datatype 'a Opt = None | Some of 'a end
  22943. signature Y' = sig datatype 'a Opt = None | Some of 'a end
  22944. signature Z' = sig include X' include Y' end;
  22945.  
  22946. (* this fails *)
  22947. signature X' = sig datatype 'a Opt = None | Some of 'a end
  22948. signature Y' = sig include X' end
  22949.  
  22950. (* signature Z' = sig include X' include Y' end *)
  22951. (* std_in:0.0 Compiler Bug: Signs.abstractSig.abstractType 2 *)
  22952.  
  22953. (* signature W' = sig include X' include Y' sharing type X'.Opt = Y'.Opt end *)
  22954. (* std_in:0.0 Compiler Bug: Signs.abstractSig.abstractType 2 *)
  22955.  
  22956. signature X' = sig type opt end
  22957. signature Y' = sig type opt end
  22958. (* signature Z' = sig include X' include Y' sharing type X'.opt = Y'.opt end *)
  22959. (* std_in:2.20-2.70 Error: unbound structure id in sharing specification: X' *)
  22960.  
  22961.  
  22962. (* How do I build a signature which brings a shared type to top level? *)
  22963.  
  22964. signature Z' =
  22965.     sig structure X : X' structure Y : Y'
  22966.     sharing type X.opt = Y.opt
  22967.     open X
  22968.     end
  22969.  
  22970. structure Z : Z' =
  22971.     struct
  22972.     structure X = struct type opt = int end
  22973.     structure Y = struct type opt = int end
  22974.     open X
  22975.     end;
  22976. (* structure Z :
  22977.   sig
  22978.     structure X : sig...end
  22979.     structure Y : sig...end
  22980.   end *)
  22981.  
  22982. (* 5 : Z.opt; *)
  22983. (* std_in:10.5-10.9 Error: unbound type in structure: opt *)
  22984. Status: fixed in 0.84
  22985. ----------------------------------------------------------------------
  22986. 494. bogus gc message
  22987. Submitter: Bob Harper
  22988. Date: 12/16/91
  22989. Version: 0.75
  22990. Severity: minor
  22991. Problem: 
  22992.   negative number in "[Increasing heap to -12217k]" message
  22993. Transcript: 
  22994.     [reading .../front/printback.sml]
  22995.  
  22996.     [Major collection...
  22997.     [Increasing heap to 8110k]
  22998.  
  22999.     [Increasing heap to 7942k]
  23000.  
  23001.     [Increasing heap to 7438k]
  23002.  
  23003.     [Increasing heap to 5926k]
  23004.  
  23005.     [Increasing heap to 1390k]
  23006.     smlsg: could not sbrk, return = 1
  23007.  
  23008.     [Increasing heap to -12217k]                *** NB
  23009.      48% used (2767236/5647472), 2570 msec]
  23010.  
  23011.     [Increasing heap to 8270k]
  23012.     [writing .../.@sys/printback.sml.bin... done]
  23013.     [closing .../front/printback.sml]
  23014.  
  23015. Status: open
  23016. --------------------------------------------------------------------
  23017. 495. inaccurate emacs info file
  23018. Submitter:      dan@math.uiuc.edu
  23019. Date:        12/26/91
  23020. Version:        75
  23021. Severity:       minor
  23022. Problem:        
  23023.  
  23024.     From the IO node in the emacs info file "sml"
  23025.  
  23026.         val execute : string -> instream * outstream
  23027.  
  23028.     From the program
  23029.  
  23030.     - execute;
  23031.     val it = fn : string * string list -> instream * outstream
  23032.  
  23033. Fix: edit the file "sml" to give the correct declaration for "execute"
  23034. Status: fixed (in /usr/local/sml/75/lib/emacs/info/sml)
  23035. ----------------------------------------------------------------------
  23036. 496. incorrect defn of dec in fastlib
  23037. Submitter:      Stephen Adams,  S.R.Adams@ecs.soton.ac.uk
  23038. Date:        3 Jan 1992
  23039. Version:        0.75
  23040. Severity:       curiosity
  23041. Problem:        Curious code in compiler source
  23042.  
  23043. I have been looking in the compiler source and I discovered
  23044. a small bug:
  23045. Code:
  23046. (* cpsopt.sml
  23047.  *
  23048.  * Copyright 1989 by AT&T Bell Laboratories
  23049.  *)
  23050. functor CPSopt(val maxfree : int) :
  23051.         sig val reduce : CPS.function * System.Unsafe.object option * bool
  23052.                                         -> CPS.function
  23053.         end =
  23054. struct
  23055.  
  23056. structure Fastlib = struct
  23057.  
  23058. structure Ref = 
  23059.   struct
  23060.     open Ref
  23061.     fun inc r = r := !r + 1
  23062.     fun dec r = r := !r + 1        (* this is the worrying bit!*)
  23063.   end
  23064.  
  23065. Comment:
  23066.   dec is used but only in the function `unescapeargs'.  I
  23067.   guess that it should be fixed before it causes any grief.
  23068. Status: Fixed in 0.75
  23069. ----------------------------------------------------------------------
  23070. 497. ML-Yacc doesn't open Array
  23071. Submitter:    Lie Ma, ma@cs.pdx.edu
  23072. Date:        12/26/91
  23073. Version:    SML Ver.77
  23074. System:        SUN Sparc
  23075. Code:        base.sml
  23076. Encl:        typescript
  23077. Problem:
  23078.  
  23079.         Error found when loading base.sml,
  23080.         while no problem using SML Ver.66.
  23081.  
  23082.         Or, is there new version of smlyacc
  23083.         corporated with the new version of SML?
  23084.  
  23085. ---------------------- Typescript ----------------------
  23086.  
  23087. Script started on Thu Dec 26 22:45:01 1991
  23088. warning: could not update utmp entry
  23089. antares% cat makepaqrser.sml" ";
  23090. Unmatched ".
  23091. antares% cat makeparser.sml
  23092. (* ------------------------ FILE: makeparser.sml ----------------------------
  23093.    Author: Lie Ma                        12/10/1991
  23094.    Usage:  Call the files "spec.grm.sig", "spec.grm.sml" (generated by 
  23095.        "smlyacc.sml" according to "spec.grm") and "spec.lex.sml" 
  23096.        (gnerated by "lexgen.sml" according to "spec.lex"). Then use
  23097.        structure "SpecLrVals", "SpecLex" and "SpecParser" to generate 
  23098.        the parser.
  23099.  
  23100.    Call:   spec.grm.sig, spec.grm.sml, spec.lex.sml
  23101.    Input:  nothing
  23102.    Output: parser
  23103.    -------------------------------------------------------------------------- *)
  23104.  
  23105. use "YACC/base.sml";    (* laod the common modules     *)
  23106. use "spec.grm.sig";    (* load grammar signature file     *)
  23107. use "spec.lex.sml";    (* load lexer program file     *)
  23108. use "spec.grm.sml";    (* load grammar program file     *)
  23109.  
  23110.  
  23111. (* --------- define structures ------------ *)
  23112.  
  23113. structure SpecLrVals =
  23114.     SpecLrValsFun(structure Token = LrParser.Token);
  23115. structure SpecLex = 
  23116.     SpecLexFun(structure Tokens =
  23117.         SpecLrVals.Tokens);
  23118. structure SpecParser =
  23119.     Join(structure ParserData = SpecLrVals.ParserData
  23120.         structure Lex=SpecLex
  23121.         structure LrParser=LrParser);
  23122.  
  23123.  
  23124. (* ----------- function parse to read file and parse it -------------- *)
  23125.  
  23126. val parse = fn s =>
  23127.   let val dev = open_in s
  23128.       val stream = SpecParser.makeLexer(fn i => input(dev,i))
  23129.       val _ = SpecLex.UserDeclarations.pos:=1
  23130.       val error = fn(e,i: int,_) => output(std_out, s ^ "," ^ " line "^
  23131.                     (makestring i) ^ ", Error: " ^ e ^ "\n")
  23132.   in SpecParser.parse(30,stream,error,()) before close_in dev
  23133.   end
  23134.  
  23135. val keybd = fn () =>
  23136.   let val dev = std_in
  23137.       val stream = SpecParser.makeLexer (fn i => input_line dev)
  23138.       val _ = SpecLex.UserDeclarations.pos:=1
  23139.       val error = fn(e,i: int,_) => output(std_out, "std_in, line "^
  23140.                     (makestring i) ^ ", Error: " ^ e ^ "\n")
  23141.   in SpecParser.parse(0,stream,error,()) 
  23142.   end
  23143. antares% sml
  23144. Standard ML of New Jersey, Version 75, November 11, 1991
  23145. Arrays have changed; see Release Notes
  23146. val it = () : unit
  23147. - " use "makeparser.sml";
  23148. [opening makeparser.sml]
  23149. [opening YACC/base.sml]
  23150. signature STREAM = 
  23151.   sig
  23152.     type 'a stream
  23153.     val streamify : (unit -> '1a) -> '1a stream
  23154.     val cons : '1a * '1a stream -> '1a stream
  23155.     val get : '1a stream -> '1a * '1a stream
  23156.   end
  23157. signature LR_TABLE = 
  23158.   sig
  23159.     datatype state
  23160.       con STATE : int -> state
  23161.     datatype term
  23162.       con T : int -> term
  23163.     datatype nonterm
  23164.       con NT : int -> nonterm
  23165.     datatype action
  23166.       con ACCEPT : action
  23167.       con ERROR : action
  23168.       con REDUCE : int -> action
  23169.       con SHIFT : state -> action
  23170.     type table
  23171.     val numStates : table -> int
  23172.     val describeActions : table -> state -> (term * action) list * action
  23173.     val describeGoto : table -> state -> (nonterm * state) list
  23174.     val action : table -> state * term -> action
  23175.     val goto : table -> state * nonterm -> state
  23176.     val initialState : table -> state
  23177.     exception Goto of state * nonterm
  23178.     val mkLrTable : {actions:((term * action) list * action) list,gotos:(nonterm * state) list list,initialState:state,numStates:int} -> table
  23179.   end
  23180. signature TOKEN = 
  23181.   sig
  23182.     structure LrTable : ...
  23183.     datatype ('a,'b) token
  23184.       con TOKEN : LrTable.term * ('a * 'b * 'b) -> ('a,'b) token
  23185.     val sameToken : ('a,'b) token * ('a,'b) token -> bool
  23186.   end
  23187. signature LR_PARSER = 
  23188.   sig
  23189.     structure Stream : ...
  23190.     structure LrTable : ...
  23191.     structure Token : ...
  23192.     exception ParseError
  23193.     val parse : {arg:'a,ec:{error:string * '1c * '1c -> unit,errtermvalue:LrTable.term -> '1b,is_keyword:LrTable.term -> bool,noShift:LrTable.term -> bool,preferred_insert:LrTable.term -> bool,preferred_subst:LrTable.term -> LrTable.term list,showTerminal> :LrTable.term -> string,terms:LrTable.term list},lexer:('1b,'1c) Token.token Stream.stream,lookahead:int,saction:int * '1c * (LrTable.state * ('1b * '1c * '1c)) list * 'a -> LrTable.nonterm * ('1b * '1c * '1c) * (LrTable.state * ('1b * '1c * '1c)) list,ta> ble:LrTable.table,void:'1b} -> '1b * ('1b,'1c) Token.token Stream.stream
  23194.     sharing Token.LrTable = LrTable
  23195.   end
  23196. signature LEXER = 
  23197.   sig
  23198.     structure UserDeclarations : ...
  23199.     val makeLexer : (int -> string) -> unit -> (UserDeclarations.svalue,UserDeclarations.pos) UserDeclarations.token
  23200.   end
  23201. signature ARG_LEXER = 
  23202.   sig
  23203.     structure UserDeclarations : ...
  23204.     val makeLexer : (int -> string) -> UserDeclarations.arg -> unit -> (UserDeclarations.svalue,UserDeclarations.pos) UserDeclarations.token
  23205.   end
  23206. signature PARSER_DATA = 
  23207.   sig
  23208.     type pos
  23209.     type svalue
  23210.     type arg
  23211.     type result
  23212.     structure LrTable : ...
  23213.     structure Token : ...
  23214.     structure Actions : ...
  23215.     structure EC : ...
  23216.     val table : LrTable.table
  23217.     sharing LrTable = Token.LrTable
  23218.   end
  23219. signature PARSER = 
  23220.   sig
  23221.     structure Token : ...
  23222.     structure Stream : ...
  23223.     exception ParseError
  23224.     type pos
  23225.     type result
  23226.     type arg
  23227.     type svalue
  23228.     val makeLexer : (int -> string) -> (svalue,pos) Token.token Stream.stream
  23229.     val parse : int * (svalue,pos) Token.token Stream.stream * (string * pos * pos -> unit) * arg -> result * (svalue,pos) Token.token Stream.stream
  23230.     val sameToken : (svalue,pos) Token.token * (svalue,pos) Token.token -> bool
  23231.   end
  23232. signature ARG_PARSER = 
  23233.   sig
  23234.     structure Token : ...
  23235.     structure Stream : ...
  23236.     exception ParseError
  23237.     type arg
  23238.     type lexarg
  23239.     type pos
  23240.     type result
  23241.     type svalue
  23242.     val makeLexer : (int -> string) -> lexarg -> (svalue,pos) Token.token Stream.stream
  23243.     val parse : int * (svalue,pos) Token.token Stream.stream * (string * pos * pos -> unit) * arg -> result * (svalue,pos) Token.token Stream.stream
  23244.     val sameToken : (svalue,pos) Token.token * (svalue,pos) Token.token -> bool
  23245.   end
  23246. structure Stream : STREAM
  23247. YACC/base.sml:340.14-340.16 Error: unbound variable or constructor sub
  23248. YACC/base.sml:342.10-342.25 Error: operator and operand don't agree (tycon mismatch)
  23249.   operator domain: 'Z array
  23250.   operand:         error -> int -> 'Y
  23251.   in expression:
  23252.     length a
  23253. YACC/base.sml:342.26 Error: overloaded variable "-" cannot be resolved
  23254. YACC/base.sml:395.36-395.38 Error: unbound variable or constructor sub
  23255. YACC/base.sml:395.28-395.45 Error: operator is not a function
  23256.   operator: (int array * int) array
  23257.   in expression:
  23258.     action bogus
  23259. YACC/base.sml:402.26-402.28 Error: unbound variable or constructor sub
  23260. YACC/base.sml:402.20-402.35 Error: operator is not a function
  23261.   operator: int array array
  23262.   in expression:
  23263.     goto bogus
  23264. YACC/base.sml:409.45-409.47 Error: unbound variable or constructor sub
  23265. YACC/base.sml:421.53-421.55 Error: unbound variable or constructor sub
  23266. YACC/base.sml:418.27-418.48 Error: operator and operand don't agree (tycon mismatch)
  23267.   operator domain: 'Z array
  23268.   operand:         error -> int -> int
  23269.   in expression:
  23270.     length row
  23271. YACC/base.sml:421.40-421.62 Error: operator is not a function
  23272.   operator: (int array * int) array
  23273.   in expression:
  23274.     action bogus
  23275. YACC/base.sml:418.46 Error: overloaded variable "-" cannot be resolved
  23276. YACC/base.sml:427.29-427.31 Error: unbound variable or constructor sub
  23277. YACC/base.sml:431.49-431.51 Error: unbound variable or constructor sub
  23278. YACC/base.sml:427.14-427.37 Error: operator is not a function
  23279.   operator: int array array
  23280.   in expression:
  23281.     goto bogus
  23282. YACC/base.sml:447.5-447.15 Error: unbound variable or constructor arrayoflist
  23283. YACC/base.sml:449.5-449.15 Error: unbound variable or constructor arrayoflist
  23284. YACC/base.sml:450.17-450.27 Error: unbound variable or constructor arrayoflist
  23285. YACC/base.sml:453.14-453.24 Error: unbound variable or constructor arrayoflist
  23286. [closing YACC/base.sml]
  23287. [closing makeparser.sml]
  23288. - ^Dantares% ^D
  23289. script done on Thu Dec 26 22:46:17 1991
  23290. Status: fixed in 0.84
  23291. ----------------------------------------------------------------------
  23292. 498. bad function type in perv.sig
  23293. Submitter: Embden Gansner
  23294. Date: 1/7/92
  23295. Version: ?
  23296. Severity: significant
  23297. Problem: 
  23298.     The BITS signature in perv.sig should have
  23299.     val notb : int -> int
  23300.     instead of 
  23301.     val notb : int * int -> int
  23302. Status: fixed in 0.81
  23303. ----------------------------------------------------------------------
  23304. 499. execute broken
  23305. Submitter: David Spooner (spoonerd@.cpsc.ucalgary.ca)
  23306. Date: 1/7/92
  23307. Version: 0.75
  23308. System: ?
  23309. Severity: major 
  23310. Problem: 
  23311.   No output availabe from execute.
  23312. Transcript: 
  23313.     Standard ML of New Jersey, Version 75, November 11, 1991
  23314.     Arrays have changed; see Release Notes
  23315.     val it = () :unit
  23316.  
  23317.     - val (instr,outstr) = execute ("ls", []);
  23318.     val instr = - :instream
  23319.     val outstr = - :outstream
  23320.  
  23321.     - input (instr, 5);
  23322.     val it = "" :string
  23323.  
  23324.     - can_input instr;
  23325.     val it = 0 :int
  23326. Fix: (luochen@shade.Princeton.EDU (Luoqi Chen))
  23327.     I believe the problem is in the runtime routine, ml_exec(), it calls
  23328.     execve(2) instead of execvp(3), so it won't look up in the PATH for the
  23329.     command. Try "/bin/ls" instead.
  23330.  
  23331.     The fix is simple, change the line (line 1238 of src/runtime/cfuns.c)
  23332.         execve (cmd, argv, envp);
  23333.     to
  23334.         { extern char **environ = envp;
  23335.         execvp(cmd, argv);}
  23336. Status: fixed in 0.86
  23337. ----------------------------------------------------------------------
  23338. 500. memory leak
  23339. Submitter: Kjeld H. Mortensen, metasoft!kjeld@uunet.UU.NET, (617) 576.6920 x 22
  23340. Date: 1/7/92
  23341. Version: 0.75
  23342. System:
  23343.   SUN OS 4.1.1, ram 32Mb, swap 103Mb, and
  23344.   HPUX 8.0, ram 32Mb, swap 70Mb.
  23345. Severity: major
  23346. Problem: 
  23347.     During use of the extended compiler we see a significant slowdown of 
  23348.     this process when using v0.75 of SML/NJ (a factor 2 over a time period
  23349.     of 15 minutes reasonable heavy use, and doesn't seem to stop there).
  23350. Observations:
  23351.     1) We see absolutely no slow down when using v0.62 of SML/NJ on the
  23352.        Sun4 (haven't been able to succesfully compile this version on
  23353.        the HP9000 though).
  23354.     2) We see significant slow down when using v0.75 of SML/NJ on both
  23355.        the Sun4 and HP9000. (In spite of the slow down, the compiler 
  23356.        process gets more and more CPU-time.)
  23357.     3) Since we use the same ML-code in both cases 1) and 2), I'm lead to 
  23358.            conclude that it must be a problem in the SML/NJ system v0.75.
  23359.  
  23360. Example:
  23361.     Unfortunately I haven't been able to reproduce the phenomenon for a 
  23362.     reasonable small example.
  23363.  
  23364. Followup:
  23365. >...By the way, is your slow-down program mostly compiling things, or executing
  23366. >compiled code?
  23367.  
  23368. It is mostly executing compiled code.
  23369.  
  23370.  
  23371. I made some further investigations regarding the heap size. Each of the 
  23372. experiments performed, make up the same amount of work for the ML process
  23373. (work is measured in units of what I call "steps").
  23374.  
  23375. In the following table, "MEM-INC" is calculated using numbers from the first
  23376. and the last major collection. Let the output from the two major collections 
  23377. have the format:
  23378.  
  23379.     [Major collection... <P1>% used (<MUSED1>/<MTOT1>), <T1> msec]
  23380.     [Major collection... <Pn>% used (<MUSEDn>/<MTOTn>), <Tn> msec]
  23381.  
  23382. The numbers in "MEM-INC" then have the format: 
  23383.  
  23384.     <MUSEDn>-<MUSED1>/<MTOTn>-<MTOT1>,
  23385.  
  23386. "/" not to be confused with division.
  23387.  
  23388. The numbers in "Work" are only there to show that the compiler in each
  23389. experiment, did the same amount of computations.
  23390.  
  23391. Machine configurations:
  23392.    Sun4      , SUN OS 4.1.1, ram 32Mb, swap 103Mb, and
  23393.    HP9000s400, HPUX 8.0    , ram 32Mb, swap  70Mb.
  23394.  
  23395.  
  23396. Machine    | SML/NJ | Work/steps | MEM-INC/bytes | Number of major coll.
  23397. -----------+--------+------------+---------------+----------------------
  23398. Sun4       | v0.62  |     203    |  18292/179960 |          4
  23399. Sun4       | v0.75  |     201    | 425120/926324 |         12
  23400. HP9000s400 | v0.75  |     202    | 517352/931376 |         40
  23401.  
  23402. Comment: [dbm] This was probably fixed by restoring environment cleanup
  23403. (in 0.82).
  23404. Status: fixed in 0.84
  23405. ----------------------------------------------------------------------
  23406. 501. out of date yacc example code
  23407. Submitter: Andy Koenig
  23408. Date: 1/11/92
  23409. Version: ?
  23410. Severity: minor
  23411. Problem: 
  23412.   The calc.grm.sig, calc.grm.sml, and calc.lex.sml file in mlyacc/examples/calc
  23413.   needs to be updated.  Rerun ml-yacc and ml-lex on the appropriate files.
  23414. Fix:
  23415. In the calc directory are the following files:
  23416.  
  23417. README
  23418. calc.grm
  23419. calc.grm.desc
  23420. calc.grm.sig
  23421. calc.grm.sml
  23422. calc.lex
  23423. calc.lex.sml
  23424. join.sml
  23425. load.sml
  23426.  
  23427. Saying
  23428.  
  23429.     sml-lex calc.lex
  23430.  
  23431. rebuilds calc.lex.sml; saying
  23432.  
  23433.     sml-yacc calc.grm
  23434.  
  23435. rebuilds calc.grm.*
  23436.  
  23437. That should be done in the distribution directories so that people
  23438. will get the right versions.
  23439. [from Dave Tarditi:]
  23440.   The directory tools/mlyacc/examples contains some files
  23441.   which need to be regenerated by the new versions of
  23442.   the parser and lexer generator.
  23443.  
  23444.   You need to regenerate the files examples/calc/calc.grm.sml,
  23445.   examples/calc.lex.sml by running the parser generator
  23446.   on calc.grm and the lexer generator on calc.lex.
  23447.  
  23448.   Please remove the file examples/fol/fol.lex.sml.
  23449. Status: fixed in 0.91 (Tarditi)
  23450. ----------------------------------------------------------------------
  23451. 502. zombie sml processes
  23452. Submitter: Stephen Adams <S.R.Adams@ecs.southampton.ac.uk>
  23453. Date: 1/13/92
  23454. Version:        0.66, 0.75
  23455. System:         SunOS 4.1, sparc
  23456. Severity:       minor
  23457. Problem:        SML processes don't die if you log out
  23458. Code:           any running sml process
  23459. Comment:
  23460.     We use NJ-SML for teaching and research.  A common problem
  23461.     is if a user logs out (by selecting `exit' in X-windows, for
  23462.     example) the sml proces doesnt die, but sits there consuming
  23463.     cpu cycles (often > 40% of the cpu time).  With a large
  23464.     number of naive users this is a serious problem.  Even
  23465.     `sophisticated' users sometimes accidentally slug a machine
  23466.     for a few days.  It would be much friendlier to the
  23467.     community if an SML process running (foreground under a
  23468.     shell) under Xterm or under emacs would die when the user
  23469.     exits from X-windows or suntools.
  23470. Comment: [JHR]
  23471.     I was unable to reproduce this.  Perhaps there setup is such
  23472.     that a SIGHUP isn't getting generated.
  23473. Status: can't reproduce
  23474. ----------------------------------------------------------------------
  23475. 503. illegal instruction -- core dumps
  23476. Submitter:    Markus Freericks
  23477.         mfx@cs.tu-berlin.de
  23478. Date:        28.1.92
  23479. Version:    0.75
  23480. System:        Sparc 2 (4/50), 16M, SunOS
  23481. Severity:    Major, at least for me
  23482. Problem:
  23483. When running my compiled program, sml encounters an "illegal
  23484. instruction" and dumps core. When the program is interpreted,
  23485. there is a message
  23486. -----------------------------------------------------------------------------
  23487. Error: Compiler bug: no default in interp
  23488. -----------------------------------------------------------------------------
  23489. the bug seems to occur in a totally normal case expression. I am
  23490. currently trying to isolate the error, but would like to know whether
  23491. there is some special thing to look for. I use an sml image that
  23492. contains the full Edinburgh library; the code that dumps core is part
  23493. of the semantic rules of a parser written in sml-yacc. The code is
  23494. heavy with functionals.
  23495. Just to get an idea of what the code looks like, the function where
  23496. the error occurs is
  23497. -----------------------------------------------------------------------------
  23498. fun makeParamDecl(oflag:bool,headId:S.T,(id,arglists:((S.T * Texpr) list list)),body : Texpr)=
  23499.   fn {env=E} =>
  23500.   let
  23501.     fun loop ([]:(S.T*Texpr)list list,comb:ACexpr->ACexpr,env) 
  23502.       = let
  23503.       val {free=f,used=u,expr=e} = body {env=env}
  23504.     in
  23505.       {defs = [id],
  23506.        expr = {free=f,
  23507.            used=u,
  23508.            expr=comb(e)
  23509.            }}
  23510.     end
  23511.       | loop (args::argss,comb,env) 
  23512.     = let
  23513.         (* rename the parameters if necessary *)
  23514.         val params = map #1 args
  23515.         val typtexprs = map #2 args
  23516.         val typacterms= map (fn x => x {env=env}) typtexprs
  23517.         val typcterms = map (fn x => (output(std_out,"mpdloop1\n");
  23518.                       (case x of
  23519.                          (Complex(_)) => output(std_out,"complex\n")
  23520.                        | (Atomic(_)) =>  output(std_out,"atomic\n"));
  23521.                          output(std_out,"mpdloop2\n");
  23522.                          (case x of 
  23523.                         Atomic(X) => X
  23524.                           | Complex(Y)=> (output(std_out,"error: type var must be atomic:\n");
  23525.                                   Cterm.print std_out (Y objVar);
  23526.                                   objVar))
  23527.                         )) typacterms
  23528.         val renames = renameSyms env params
  23529.         val env' = Env.addList (ListPair.zip(params,renames)) env
  23530.         val env''= putNewEE(putNewState(env))
  23531.         val k = S.gen("_k")
  23532.         fun comb' x = comb(Atomic(C.Lambda((ListPair.zip(renames,typcterms))@
  23533.                            [(k,objVar),
  23534.                         (getEE env'',objVar),
  23535.                         (getState env'',objVar)],
  23536.                            applyK(x,C.Var(k),env''))))
  23537.       in
  23538.         loop(argss,comb',env')
  23539.       end
  23540.   in
  23541.     loop(arglists,(fn x=>x),E)
  23542.   end
  23543.  
  23544. Comment:
  23545.   when called, "mpdloop1" gets printed, then the error message appears.
  23546.   This is independent of the value of "x" (Atomic of Complex).
  23547.   As I said, am trying to reduce the error-generating code to manageable
  23548.   size and send that to you, but that may take a while.
  23549. Status: fixed in 0.75
  23550. ----------------------------------------------------------------------
  23551. 504. Another core dump
  23552. Submitter:    Markus Freericks
  23553.         mfx@cs.tu-berlin.de
  23554. Date:        28.1.92
  23555. Version:    0.75
  23556. System:        Sparc 2 (4/50), 16M, SunOS
  23557. Severity:    Major, at least for me
  23558.  
  23559. This is a followup to my earlier message. The following code dumps
  23560. core on my machine, even though it is interpreted!
  23561. (I hadn't got the nerve to reduce it any further, because startup-time
  23562. for sml on this system is in the order of 30 seconds)
  23563.  
  23564. Code:
  23565. SML_NJ.Control.interp :=true;
  23566.  
  23567. structure Symbol=Int
  23568.  
  23569. signature CTERM =
  23570.   sig
  23571.     datatype CONV = Check | Cast
  23572.  
  23573.     datatype T =
  23574.       Var of Symbol.T
  23575.     | Const of String.T
  23576.     | Apply of T list
  23577.  
  23578.     val print : outstream -> T -> unit
  23579.  
  23580.     end
  23581.  
  23582. structure Cterm : CTERM =
  23583.   struct
  23584.     datatype CONV = Check | Cast
  23585.     datatype T = 
  23586.       Var of Symbol.T
  23587.     | Const of String.T
  23588.     | Apply of T list
  23589.  
  23590.     fun indStringList indent =      
  23591.       fn Var(x) => [(indent,"var")]
  23592.        | Const(s) => [(indent,"const")]
  23593.        | Apply(args) =>
  23594.        (List.foldR' 
  23595.          (fn a => fn b => a @ b)
  23596.          (map 
  23597.           (fn (expr) => 
  23598.            (indStringList (indent+1) expr))
  23599.           args))
  23600.  
  23601.     fun print os x = ((indStringList 1 x);())
  23602.       
  23603.   end
  23604.  
  23605. structure B =
  23606.   struct
  23607.     structure S = Symbol
  23608.     structure SS = Int
  23609.     structure C = Cterm
  23610.  
  23611.     type Env = bool
  23612.       
  23613.     datatype ACexpr = 
  23614.       Atomic of C.T
  23615.     | Complex of C.T -> C.T 
  23616.       
  23617.     type TexprResult = {free:SS.T,used:SS.T,expr:ACexpr}
  23618.     type Texpr = {env:Env} -> TexprResult
  23619.  
  23620.     fun mkDummyExpr(x) : Texpr = fn {env=E} => {free = 1 ,
  23621.                         used = 2 ,
  23622.                         expr = Atomic(C.Const("\"dummyE:"^x^"\""))}
  23623.       
  23624.     val dummyExpr = mkDummyExpr("")
  23625.       
  23626.     val objVar = C.Var(1)
  23627.  
  23628.     fun makeParamDecl((id,arglists:((S.T * Texpr) list list)),body : Texpr)=
  23629.       fn {env=E} =>
  23630.       let
  23631.     fun loop ([],comb:ACexpr->ACexpr,env) 
  23632.        = let
  23633.            val {free=f,used=u,expr=e} = body {env=env}
  23634.          in
  23635.            {defs = [id],
  23636.         expr = {free=f,
  23637.             used=u,
  23638.             expr=comb(e)
  23639.             }}
  23640.          end
  23641.        | loop (args::argss,comb,env) 
  23642.          = let
  23643.          (* rename the parameters if necessary *)
  23644.          val params = map #1 args (* typcon mismatch if *)
  23645.                       (* commented out *)
  23646.          val typtexprs = map (fn (a,b)=>b) args
  23647.          val typacterms= map (fn x => x {env=env}) typtexprs
  23648.                     (* typacterms=[Atomic(objVar)] would be ok *)
  23649.                     (* [] instead of typtexprs would be ok,too *)
  23650.          val _ = output(std_out,"makeParamDecl-2\n")
  23651.          val typcterms = map (fn x => (output(std_out,"mpdloop1\n");
  23652. (*XXXX*)
  23653.                            (case x of
  23654.                           (Complex _) => output(std_out,"complex\n")
  23655.                         | (Atomic _) =>  output(std_out,"atomic\n"));
  23656.                           output(std_out,"mpdloop2\n");
  23657.                           (case x of 
  23658.                              Atomic(X) => (
  23659.                                    (*this here print causes the error!*)
  23660.                                    Cterm.print std_out X;
  23661.                                    X)
  23662.                            | Complex(Y)=> (output(std_out,"error: type var must be atomic:\n");
  23663.                                    Cterm.print std_out (Y objVar);
  23664.                                    objVar))
  23665.                              )) typacterms
  23666.          val _ = output(std_out,"makeParamDecl-5\n")
  23667.            in
  23668.          loop(argss,comb,env)
  23669.            end
  23670.       in
  23671.     loop(arglists,(fn x=>x),E)
  23672.       end
  23673.     
  23674.   end;
  23675.  
  23676. val xx = B.makeParamDecl((12,
  23677.               [[(1,B.dummyExpr)]]),
  23678.              B.dummyExpr
  23679.              );
  23680.   
  23681.   
  23682. fun killMe() = xx({env=true})
  23683.  
  23684. (* calling killMe results in a bus error *)
  23685.  
  23686. killMe()
  23687.  
  23688. Comment:
  23689.   The main problem seems to be the type error at (*XXXX*): 
  23690.   "typtexprs" is of type "Texpr", so "typacterms" is a "TexprResult",
  23691.   not an "ACterm", as assumed by the "case x of Atomic...".
  23692.  
  23693.   This being undetected, a runtime error follows quite naturally. Funny
  23694.   enough, if the "Apply" clause in "indStringList" is removed by some
  23695.   simple rhs that doesn't inspect the argument of the Apply, no runtime error
  23696.   occurs.
  23697.  
  23698.   PS. After having found the type error, the function runs fine. Guess
  23699.   that makes the Severity "minor, at least for me".
  23700.  
  23701. Status: fixed in 0.75
  23702. ----------------------------------------------------------------------
  23703. 505. bad datatype definition accepted
  23704. Submitter: John Reppy
  23705. Date: 1/28/92
  23706. Version: 0.76
  23707. Severity: minor
  23708. Problem: 
  23709.   The following is not legal SML (cf. Definition, sec 2.9), but is
  23710.   accepted by the compiler:
  23711. Transcript: 
  23712.   Standard ML of New Jersey, Version 0.76, December 14, 1991
  23713.   Arrays have changed; see Release Notes
  23714.   val it = () : unit
  23715.   - datatype foo = FOO of int | BAR and bar = BAR;
  23716.   datatype  foo
  23717.   con BAR : foo
  23718.   con FOO : int -> foo
  23719.   datatype  bar
  23720.   con BAR : bar
  23721. Status: fixed in 0.91 (dbm)
  23722. ----------------------------------------------------------------------
  23723. 506. Runbind exception
  23724. Submitter:      Thomas M. Breuel <tmb@ai.mit.edu>
  23725. Date:        31 Jan 1992
  23726. Version:        0.75
  23727. System:         SparcStation IPC SunOS 4.1.1
  23728. Severity:       major (?)
  23729. Problem:        code dies with "uncaught exception Runbind" when put
  23730.         into "structure All"
  23731. Code:
  23732.  
  23733. local type time = System.Timer.time
  23734.     val timeofday : unit -> time = 
  23735.     System.Unsafe.CInterface.c_function "timeofday"
  23736. in 
  23737.     fun timeit f  = 
  23738.     let open System.Timer
  23739.         val t = start_timer()
  23740.         val rt = timeofday()
  23741.         val z = f ()
  23742.         val rt' = sub_time(timeofday(),rt)
  23743.         val t' = check_timer t
  23744.         val ts = check_timer_sys t
  23745.         val tg = check_timer_gc t
  23746.     in
  23747.         print(implode["user: ",makestring t',
  23748.               "  gc: ", makestring tg, 
  23749.               "  system: ",makestring ts,
  23750.               "  real: ",makestring rt',"\n"]);
  23751.         z
  23752.     end
  23753. end;
  23754.  
  23755. structure All = struct
  23756.  
  23757. signature RA2 =
  23758.     sig
  23759.     exception Subscript
  23760.     type array
  23761.     val array : (int * int) * real -> array
  23762.     val dim : array * int -> int
  23763.     val sub : array * (int * int) -> real
  23764.     val update : array * (int * int) * real -> unit
  23765.     end;
  23766.  
  23767. structure X:RA2 =
  23768.     struct
  23769.     structure R = RealArray
  23770.     exception Subscript = R.RealSubscript
  23771.     datatype array = A of (int * int) * R.realarray
  23772.     fun array((d0,d1),initial) = A((d0,d1),R.array(d0*d1,initial))
  23773.     fun dim(A((d0,d1),_),0) = d0
  23774.       | dim(A((d0,d1),_),1) = d1
  23775.       | dim _ = raise Subscript
  23776.     fun sub(A((d0,d1),a),(i,j)) = R.sub(a,i*d1+j)
  23777.     fun update(A((d0,d1),a),(i,j),v) = R.update(a,i*d1+j,v)
  23778.     end;
  23779.  
  23780. structure Y:RA2 =
  23781.     struct
  23782.     structure R = RealArray
  23783.     structure A = Array
  23784.     exception Subscript = R.RealSubscript (*HACK*)
  23785.     type array = R.realarray A.array
  23786.     fun dim(a,0) = A.length(a)
  23787.       | dim(a,1) = R.length(A.sub(a,0))
  23788.       | dim _ = raise Subscript
  23789.     fun array((d0,d1),initial) = A.tabulate(d0,fn j => R.array(d1,initial))
  23790.     fun sub(a,(i,j)) = R.sub(A.sub(a,i),j)
  23791.     fun update(a,(i,j),v) = R.update(A.sub(a,i),j,v)
  23792.     end;
  23793.  
  23794. functor Test(A2:RA2) =
  23795.     struct
  23796.     fun dotimes(n,f) =
  23797.         let
  23798.         fun loop(i) = if i>=n then () else (f(i); loop(i+1))
  23799.         in
  23800.         loop(0)
  23801.         end
  23802.     fun foldtimes(n,r,f) =
  23803.         let
  23804.         fun loop(i,r) = if i>=n then r else loop(i+1,f(r,i))
  23805.         in
  23806.         loop(0,r)
  23807.         end
  23808.     fun a before b = a
  23809.     fun fold(a,r,f) =
  23810.         foldtimes(A2.dim(a,1),r,fn (r,y) =>
  23811.               foldtimes(A2.dim(a,0),0.0,fn (r,x) =>
  23812.                 (f(r,A2.sub(a,(x,y)))) before (A2.update(a,(x,y),r))))
  23813.     fun bound(x) = if x>=1.0 then bound(x-1.0) else x
  23814.     fun combine(x,y) = bound(x*1.17812+y)
  23815.     fun doit() =
  23816.         let
  23817.         val w = 512
  23818.         val h = 512
  23819.         val a = A2.array((w,h),0.0001)
  23820.         in
  23821.         dotimes(2,fn i => fold(a,0.0,combine))
  23822.         end
  23823.     val _ = timeit(doit)
  23824.     end;
  23825.  
  23826. end;
  23827.  
  23828. open All;
  23829.  
  23830. Transcript:
  23831.  
  23832. Standard ML of New Jersey, Version 75, November 11, 1991
  23833. Arrays have changed; see Release Notes
  23834. val it = () : unit
  23835. - [opening compare.sml]
  23836. val timeit = fn : (unit -> 'a) -> 'a
  23837. compare.sml:25.1-33.7 Warning: signature found inside structure or functor
  23838. compare.sml:62.1-92.7 Warning: functor found inside structure or functor
  23839. structure All : 
  23840.   sig
  23841.     signature RA2 = 
  23842.       sig
  23843.         exception Subscript
  23844.         type array
  23845.         val array : (int * int) * real -> array
  23846.         val dim : array * int -> int
  23847.         val sub : array * (int * int) -> real
  23848.         val update : array * (int * int) * real -> unit
  23849.       end
  23850.     functor Test : <sig>
  23851.     structure X : RA2
  23852.     structure Y : RA2
  23853.   end
  23854. open All
  23855. [closing compare.sml]
  23856. val it = () : unit
  23857. - structure Dummy = Test(X);
  23858.  
  23859. uncaught exception Runbind
  23860.  
  23861. Comments:
  23862.  
  23863. This seems to be different from the bugs relating to Runbind in
  23864. the masterbugs list (all of those claim to have been fixed or
  23865. claim to be unreproducible).
  23866.  
  23867. Status: fixed in 0.84
  23868. ----------------------------------------------------------------------
  23869. 507. most negative integer causes compiler bug (see also 630, 632)
  23870. Submitter: Thomas Yan (tyan@cs.cornell.edu)
  23871. Date: 2/3/92
  23872. Version: 0.75?
  23873. Severity: minor
  23874. Problem: 
  23875.   Sometimes the compiler has problems with the most negative integer:
  23876. Transcript: 
  23877.     fun f ~0x40000000 = 7;
  23878.     std_in:1.1-1.21 Warning: match not exhaustive
  23879.     ~1073741824 => ...
  23880.     Error: Compiler bug: Overflow in cps/generic.sml
  23881.     - 
  23882. Status: fixed in 0.90
  23883. ----------------------------------------------------------------------
  23884. 508. xorb
  23885. Submitter: Thomas Yan (tyan@cs.cornell.edu)
  23886. Date: 2/3/92
  23887. Version: 0.75?
  23888. Severity: minor
  23889. Problem: 
  23890.   xorb gives wrong answer
  23891. Transcript:
  23892.     - fun f x = x xorb  ~0x40000000;
  23893.     val f = fn : int -> int
  23894.     - f 0;
  23895.     val it = 
  23896.     uncaught exception Boxity
  23897.     - fun f x = x xorb  ~0x40000000;
  23898.     val f = fn : int -> int
  23899.     - f 0;
  23900.     val it = ~1073741824 : int
  23901.     - 
  23902. Status: fixed in 0.84
  23903. ----------------------------------------------------------------------
  23904. 509. compiler bug in number pattern
  23905. Submitter: Thomas Yan (tyan@cs.cornell.edu)
  23906. Date: 2/3/92
  23907. Version: 0.75?
  23908. Severity: minor
  23909. Problem: 
  23910.   Compiler bug in hexidecimal pattern
  23911. Transcript:
  23912.     - fun f 0x3fffffff = 2;
  23913.     std_in:3.1-3.20 Warning: match not exhaustive
  23914.     1073741823 => ...
  23915.     Error: Compiler bug: Overflow in cps/generic.sml
  23916. Comment:
  23917.     After looking at cps/generic.sml, I think the problem is with generating code
  23918.     with immediate data.  Often, things like (INT u) op v get translated into
  23919.     <machine op> (immed (u+u)) v, where the u+u is for the boxity scheme (the +1
  23920.     comes from v).  But when u is already near the limit, then u+u overflows.
  23921.     Obviously, it would be nice for this to get fixed.
  23922. Status: open (duplicate of 507)
  23923. ----------------------------------------------------------------------
  23924. 510. poor error message in ml-lex (same as 475)
  23925. Submitter: Reppy
  23926. Date: 2/1/92
  23927. Version: 0.75?
  23928. Severity: minor?
  23929. Problem: 
  23930. The following lex file
  23931.  
  23932.   %%
  23933.   special = [@#$%^&*_+=|\\/<>-];
  23934.   %%
  23935.   <INITIAL>\n      => (inc ln; lex());
  23936.  
  23937. produces
  23938.  
  23939.   ? sml-lex: uncaught exception LOOKUP
  23940.  
  23941. Comments:
  23942.   I believe this is because there are special characters in the [...],
  23943.   but this is a poor error message.
  23944. Status: same as 475
  23945. ----------------------------------------------------------------------
  23946. 511. dying on interupt with SIGEMT (same as 484, 518)
  23947. Submitter:    tmb@ai.mit.edu (Thomas M. Breuel)
  23948. Date:        January 14, 1992
  23949. Version:    0.75
  23950. System:        SunOS 4.1.?, Sparc IPC
  23951. Severity:    major
  23952. Problem:    When typing Control-C, the system dies with a SIGEMT
  23953. Code:        (this doesn't seem to be specific to any code)
  23954. Transcript:
  23955.  
  23956. - trymatches(model,image,BoundedMatch.eval,5.0,10.0,0.4);
  23957. ((17.0,11.0),(222.0,175.0))
  23958. ((5.0,5.00028),(552.0,473.0))
  23959. ((~217.0,~169.99972),(535.0,462.0))
  23960. ~217.0
  23961. ~212.0
  23962. SIGEMT not related to gc (bogus test: 0x9de3bfc0 @ 0xa150)
  23963.  
  23964. Process Inferior mysml exited abnormally with code 3
  23965.  
  23966. Comments:
  23967.     This is also given as bug 304 in the "masterbugs" list, but it is not
  23968.     listed in the "openbugs" list anymore. Did this bug come back or was
  23969.     it never fixed?
  23970.     Based on the PC info, this was probably an OS bug.  Changes to the
  23971.     GC invocation mechanism mean that it is moot. -- JHR
  23972. Status: fixed
  23973. ----------------------------------------------------------------------
  23974. 512. compiler looping
  23975. Submitter:      tmb@ai.mit.edu
  23976. Date:        January 15, 1992
  23977. Version:        0.75 (loaded+dumped mylib)
  23978. System:         SunOS 4.1.?, Sparc IPC
  23979. Severity:       major
  23980. Problem:        compiling the red-black tree code below inside the
  23981.         "structure ... = struct ... end" fills up memory
  23982.         and doesn't seem to terminate; compiling at top-level
  23983.         works fine
  23984. Code:
  23985.  
  23986. (* Red-Black Trees *)
  23987.  
  23988. signature ODICT =
  23989.     sig
  23990.     type 'a Dict
  23991.     val lookup : ('a -> 'b) * ('b * 'b -> bool) * 'a Dict * 'b -> 'a
  23992.     val insert : ('a -> 'b) * ('b * 'b -> bool) * 'a Dict * 'a -> 'a Dict
  23993.     val aslist : 'a Dict -> 'a list
  23994.     end;
  23995.  
  23996. structure RBTree:ODICT =
  23997.     struct
  23998.     datatype Color = Rd | Bl
  23999.     datatype 'a Node = ND of Color * 'a * 'a Node * 'a Node | LEAF;
  24000.  
  24001.     type 'a Dict = 'a Node
  24002.         
  24003.     fun aslist(LEAF) = []
  24004.       | aslist(ND(c,k,l,r)) = aslist(l) @ k @ aslist(r)
  24005.         
  24006.     exception Lookup
  24007.     
  24008.     fun lookup(key,less,LEAF,k) = raise Lookup
  24009.       | lookup(key,less,ND(_,v,l,r),k) =
  24010.         if less(k,key(v)) then lookup(key,less,l,k)
  24011.         else if less(key(v),k) then lookup(key,less,r,k)
  24012.         else v
  24013.         
  24014.     fun rewrite(ND(Bl,B,ND(Rd,A,alpha,beta),ND(Rd,C,gamma,delta))) =
  24015.         (ND(Rd,B,ND(Bl,A,alpha,beta),ND(Bl,C,gamma,delta)))
  24016.       | rewrite(ND(Bl,C,ND(Rd,A,alpha,ND(Rd,B,beta,gamma)),delta)) =
  24017.         ND(Bl,B,ND(Rd,A,alpha,beta),ND(Rd,C,gamma,delta))
  24018.       | rewrite(ND(Bl,C,ND(Rd,B,ND(Rd,A,alpha,beta),gamma),delta)) =
  24019.         ND(Bl,B,ND(Rd,A,alpha,beta),ND(Rd,C,gamma,delta))
  24020.       | rewrite(ND(Bl,A,alpha,ND(Rd,B,ND(Rd,C,beta,gamma),delta))) =
  24021.         ND(Bl,B,ND(Rd,A,alpha,beta),ND(Rd,C,gamma,delta))
  24022.       | rewrite(ND(Bl,A,alpha,ND(Rd,B,beta,ND(Rd,C,gamma,delta)))) =
  24023.         ND(Bl,B,ND(Rd,A,alpha,beta),ND(Rd,C,gamma,delta))
  24024.       | rewrite x = x;
  24025.  
  24026.     fun insert(key,less,v,tree) =
  24027.         let
  24028.         fun insert'(LEAF) = ND(Rd,v,LEAF,LEAF)
  24029.           | insert'(ND(Bl,v',left,right)) =
  24030.             if less(key(v),key(v')) then
  24031.             rewrite(ND(Bl,v',insert'(left),right))
  24032.             else if less(key(v'),key(v)) then
  24033.             rewrite(ND(Bl,v',left,insert'(right)))
  24034.             else
  24035.             ND(Bl,v',left,right)
  24036.           | insert'(ND(Rd,v',left,right)) =
  24037.             if less(key(v),key(v')) then
  24038.             ND(Rd,v',insert'(left),right)
  24039.             else if less(key(v'),key(v)) then
  24040.             ND(Rd,v',left,insert'(right))
  24041.             else
  24042.             ND(Rd,v',left,right);
  24043.         val ND(_,v,l,r)=insert'(tree)
  24044.         in
  24045.         ND(Bl,v,l,r)
  24046.         end
  24047.     
  24048.     fun create(key,less,l) =
  24049.         let
  24050.         fun loop([],r) = r
  24051.           | loop(x::xs,r) = loop(xs,insert(key,less,x,r))
  24052.         in
  24053.         loop(l,LEAF)
  24054.         end;
  24055.         
  24056.     fun id x = x
  24057.     fun lt(x:int,y) = x<y
  24058.     end;
  24059.  
  24060. Transcript:
  24061.  
  24062. NJ/SML, mylib
  24063. val it = () : unit
  24064. -             <--- I've comented out the structure...
  24065.                              surrounding the Red-Black tree code
  24066. [opening redblack.sml]
  24067. signature ODICT = 
  24068.   sig
  24069.     type 'a Dict
  24070.     val lookup : ('b -> 'a) * ('a * 'a -> bool) * 'b Dict * 'a -> 'b
  24071.     val insert : ('b -> 'a) * ('a * 'a -> bool) * 'b Dict * 'b -> 'b Dict
  24072.     val aslist : 'a Dict -> 'a list
  24073.   end
  24074. datatype  Color
  24075. con Bl : Color
  24076. con Rd : Color
  24077. datatype 'a  Node
  24078. con LEAF : 'a Node
  24079. con ND : Color * 'a * 'a Node * 'a Node -> 'a Node
  24080. type 'a  Dict = 'a Node
  24081. val aslist = fn : 'a list Node -> 'a list
  24082. exception Lookup
  24083. val lookup = fn : ('a -> 'b) * ('b * 'b -> bool) * 'a Node * 'b -> 'a
  24084. val rewrite = fn : 'a Node -> 'a Node
  24085. redblack.sml:56.3-56.31 Warning: binding not exhaustive
  24086.         ND (_,v,l,r) = ...
  24087. val insert = fn : ('a -> 'b) * ('b * 'b -> bool) * 'a * 'a Node -> 'a Node
  24088. val create = fn : ('a -> 'b) * ('b * 'b -> bool) * 'a list -> 'a Node
  24089. val id = fn : 'a -> 'a
  24090. val lt = fn : int * int -> bool
  24091. [closing redblack.sml]
  24092. val it = () : unit
  24093. -             <--- I've put the structure ... = struct ... end back
  24094. [opening redblack.sml]
  24095. signature ODICT = 
  24096.   sig
  24097.     type 'a Dict
  24098.     val lookup : ('b -> 'a) * ('a * 'a -> bool) * 'b Dict * 'a -> 'b
  24099.     val insert : ('b -> 'a) * ('a * 'a -> bool) * 'b Dict * 'b -> 'b Dict
  24100.     val aslist : 'a Dict -> 'a list
  24101.   end
  24102.  
  24103. [Major collection...
  24104. [Increasing heap to 3420k]
  24105.  
  24106. [Increasing heap to 3560k]
  24107.  
  24108. [Increasing heap to 4260k]
  24109.  
  24110. [Increasing heap to 7760k]
  24111.  69% used (1952632/2809440), 2100 msec]
  24112.  
  24113. [Increasing heap to 8192k]
  24114.  
  24115. [Major collection... 94% used (3980248/4209932), 4600 msec]
  24116.  
  24117. [Increasing heap to 12344k]
  24118.  
  24119. [Major collection...
  24120. [Increasing heap to 18924k]
  24121.  94% used (6180760/6516556), 7060 msec]
  24122.  
  24123. [Increasing heap to 19104k]
  24124.  
  24125. [Major collection...
  24126. [Increasing heap to 29280k]
  24127.  
  24128. Process Inferior sml killed        <--- kill -9 <pid>
  24129.  
  24130. Comments:
  24131.  
  24132. BTW, do you have code to delete from persistent red-black trees?  It
  24133. gets really messy...
  24134. Status: fixed in 0.84
  24135. ----------------------------------------------------------------------
  24136. 513. not waiting for execute children
  24137. Submitter: Robert S. Thau (rst@ai.mit.edu)
  24138. Date: 1/20/92
  24139. Version: ?
  24140. Severity: major
  24141. Problem: 
  24142.   SML/NJ appears not to wait for children forked off by execute.  This can be
  24143.   a problem in certain circumstances.  In my particular case, I wrote a
  24144.   routine which draws graphs for the user by forking off an xplot and sending
  24145.   down plot commands.  After fifty graphs or so, the zombie xplots had
  24146.   completely filled my per-user process limit, making it difficult to
  24147.   determine the nature of the problem (ps: cannot fork: no more processes).
  24148.  
  24149.   In this particular case, I'd be more than willing to do the wait myself,
  24150.   but execute gives me no process-id to wait for, just the input and output
  24151.   streams. 
  24152.  
  24153.   [from Phil Jeffcock <P.J.Jeffcock@bradford.ac.uk>, 3/2/92]
  24154.   I'm running SML/NJ 0.75 on my SUN Sparc IPC. I've been writing an application
  24155.   which I need to use execute frequently and in doing so the ML runtime is
  24156.   creating a zombie process each time I use it. After a short while I run out
  24157.   of process slots. Any ideas?
  24158. Fix:
  24159.   just before doing the execute, do wait3(&status,WNOHANG,NULL) to clean
  24160.   up previous children, if any.
  24161. Status: fixed in 0.91 
  24162. ----------------------------------------------------------------------
  24163. 514. uncaught exception ErrorStructure
  24164. Submitter: John Reppy
  24165. Date: 1/15/92
  24166. Version: 0.76
  24167. Severity: minor
  24168. Problem: 
  24169.     I got the following uncaught exception when working on my Amber stuff:
  24170.  
  24171.       ...
  24172.       [opening join.sml]
  24173.       join.sml:6.25-6.38 Error: unbound functor: AmberLrValsFun
  24174.       [closing join.sml]
  24175.       [closing load]
  24176.  
  24177.       uncaught exception ErrorStructure
  24178.       - 
  24179.  
  24180.     I tried a few small examples, but I wasn't able to reproduce the
  24181.     bug.  The offending file ("join.sml") is:
  24182.  
  24183.       structure AmberLrVals = AmberLrValsFun (structure Token = LrParser.Token)
  24184.       structure AmberLex = AmberLexFun (structure Tokens = AmberLrVals.Tokens)
  24185.       structure AmberParser = Join (
  24186.     structure ParserData = AmberLrVals.ParserData
  24187.     structure Lex = AmberLex
  24188.     structure LrParser = LrParser)
  24189.  
  24190.     If I add a ";" to the first line, then I just get the error message.
  24191.  
  24192.   [from Jon Thackray <jont@harlqn.co.uk>, 4/8/92]:
  24193.      Ok, here's a stripped down version of the ErrorStructure problem. I
  24194.   don't believe it can get any smaller. The significant factors seems to
  24195.   be twofold, firstly, the missing parameter to the Mir_Utils functor,
  24196.   and secondly the sharing constraint between the parameters of this
  24197.   functor. The first factor in isolation is not sufficient to produce
  24198.   the problem, as far as I can tell. Hope this helps.
  24199.  
  24200.   signature MIRTYPES =
  24201.     sig
  24202.     end;
  24203.  
  24204.   signature MIRPRINT =
  24205.     sig
  24206.       structure MirTypes    : MIRTYPES
  24207.     end;
  24208.  
  24209.   functor Mir_Utils(
  24210.     structure MirTypes : MIRTYPES
  24211.     structure MirPrint : MIRPRINT
  24212.  
  24213.     sharing MirTypes = MirPrint.MirTypes
  24214.   ) =
  24215.   struct
  24216.   end;
  24217.  
  24218.   structure MirTypes_ =
  24219.     struct
  24220.     end;
  24221.  
  24222.   structure Mir_Utils_ = Mir_Utils(
  24223.     structure MirTypes = MirTypes_
  24224.   );
  24225.  
  24226. Status: fixed in 0.84
  24227. ----------------------------------------------------------------------
  24228. 515.  Compiler bug: patType -- unexpected pattern
  24229. Submitter:      jont@uk.co.harlqn
  24230. Date:        24/01/92
  24231. Version:        SML of NJ version 0.75
  24232. System:         Sun 4/330 with Sunos 4.1.1
  24233. Severity:       minor
  24234. Problem:        Compiler bug
  24235. Code:
  24236.     | has_a_new_name (TYFUN (CONSTYPE (_,METATYNAME{ref tyfun, ...}),_)) =
  24237.  
  24238. Transcript:
  24239.  
  24240. /usr/users/jont/ml/ml_compiler/src/typechecker/_types.sml:383.57-383.61 Error: syntax error: inserting AS
  24241. /usr/users/jont/ml/ml_compiler/src/typechecker/_types.sml:1177.38 Error: syntax error: inserting ASTERISK
  24242. Error: Compiler bug: patType -- unexpected pattern
  24243. [closing /usr/users/jont/ml/ml_compiler/src/typechecker/_types.sml]
  24244. Comments: same as #474?
  24245. Status: probably fixed in 0.83
  24246. ----------------------------------------------------------------------
  24247. 516. ml-lex gives uncaught exception LOOKUP (same as 475, 510)
  24248. Submitter: John Reppy
  24249. Date: 2/4/92
  24250. Version: ?
  24251. Severity: significant
  24252. Problem: 
  24253. One of my students was getting the following mysterious error message
  24254. from mllex:
  24255.  
  24256.   ? sml-lex: uncaught exception LOOKUP
  24257.  
  24258. upon examination, the problem is that he misspelled a character class
  24259. name.  The following small file will produce this behavior:
  24260. Code: 
  24261.   <jhr@bat> cat foo.lex
  24262.   (* test file *)
  24263.  
  24264.   %%
  24265.  
  24266.   foo = [a-z];
  24267.  
  24268.   %%
  24269.  
  24270.   <INITIAL>{foob}+                => (lex());
  24271. Status: same as 475
  24272. ----------------------------------------------------------------------
  24273. 517. type errors in examples/cat.sml
  24274. Submitter: Doug McIlroy
  24275. Date: 2/4/92
  24276. Version: ?
  24277. Severity: minor
  24278. Problem: 
  24279.   doc/examples/cat.sml contains type errors
  24280. Status: fixed for 0.90 (in /usr/local/sml/75/doc/examples/cat.sml)
  24281. ----------------------------------------------------------------------
  24282. 518. interrupt causes core dump (same as 484, 511)
  24283. Submitter:      jont@uk.co.harlqn
  24284. Date:        12/02/92
  24285. Version:        SML of NJ version number 0.75
  24286. System:         Sun 4/330 with SunOS 4.1.1
  24287. Severity:       minor
  24288. Problem:        Unreliability of NJ 0.75 with ^c
  24289. Transcript:
  24290. SIGEMT not related to gc (bogus test: 0x9de3bfc0 @ 0xa150)
  24291.  
  24292. Comments:
  24293.   This seems to happen a lot when using ctrl-c to halt a looping or long
  24294.   running program. Even if this doesn't happen, the image sometimes
  24295.   seems corrupt afterwards, in that it exhibits strange (impossible)
  24296.   behaviour that doesn't occur if it is recompiled from scratch to
  24297.   supposedly the same state. I suspect there is a critcial region
  24298.   problem somewhere.
  24299. Status: open
  24300. ----------------------------------------------------------------------
  24301. 519. System.system broken after loading sml-yacc output
  24302. Submitter: John Nestoriak <nestorak@cs.psu.edu>
  24303. Date: 2/16/92
  24304. Version: 0.75
  24305. Severity: major
  24306. Problem: 
  24307.   I'm having a problem using system calls from sml 75.  Something like 
  24308.   System.system "ls"; works fine until I load the output from sml-yacc.  Then
  24309.   I get uncaught exception SystemCall.  
  24310.  
  24311.   [from cazin@tls-cs.cert.fr (Jacques Cazin), 3/26/92]
  24312.   But we use also lexgen and mlyacc which are in the distribution. After
  24313.   having loaded lexgen, we cannot use "System.system" anymore:
  24314.  
  24315.           System.system "pwd";  (or anything else)
  24316.   gives rise to 
  24317.           uncaught exception SystemCall
  24318.  
  24319.   We  previously used  version  0.56 with  lexgen as  well  and  did not
  24320.   observe this behaviour.
  24321. Status: fixed in 0.86
  24322. ----------------------------------------------------------------------
  24323. 520. broken under IRIX 4.0.1
  24324. Submitter: Lindsay Errington <lindsay@cs.mu.OZ.AU>
  24325. Date: 2/17/92
  24326. Version: 0.75
  24327. System: SGI/IRIX 4.0.1
  24328. Severity: major
  24329. Problem: 
  24330.   I'm sorry to bother you with such a vague problem but I'm having a
  24331.   little trouble with your compiler under IRIX.  We've just upgraded from
  24332.   Irix 3.3.x to version 4.0.1 and since then any attempt to use the "use"
  24333.   function made SML 0.75 hang. I tried to re-compile the runtime but then
  24334.   it only gets as far as [Executing IEEEReal] before it hangs again. I've
  24335.   done a little diddling and as far as I can tell it's hung in prim.s.
  24336.   Any suggestions on where to start looking or whom to contact?
  24337. Status: Fixed in 0.81
  24338. ----------------------------------------------------------------------
  24339. 521. type checking flex records
  24340. Submitter:      Mark Leone (mleone@cs.cmu.edu)
  24341. Date:        2/12/92
  24342. Version:        0.75
  24343. System:         Decstation 2100 under Mach 2.6
  24344. Severity:       major
  24345. Problem:        Type checker doesn't handle flex records correctly.
  24346. Code:           fun foo x = let val a = #1 x
  24347.                                 val (a,b) = x
  24348.                         in
  24349.                               b ()
  24350.                                end
  24351. Transcript:
  24352.   Standard ML of New Jersey, Version 75, November 11, 1991
  24353.   Arrays have changed; see Release Notes
  24354.   val it = () : unit
  24355.   - fun foo x = let val a = #1 x
  24356.             val (a,b) = x
  24357.         in
  24358.             b ()
  24359.         end
  24360.   ;
  24361.   = = = = = val foo = fn : 'a * 'b -> 'c
  24362.   - foo (0,0);
  24363.  
  24364.   Process sml segmentation fault
  24365. Comments: Type of foo should be ('a * (unit -> 'b)) -> 'b
  24366. Status: fixed in 0.85
  24367. ----------------------------------------------------------------------
  24368. 522. redundent patterms in compiler
  24369. Submitter: John Reppy
  24370. Date: 2/18/92
  24371. Version: 0.76?
  24372. Severity: minor
  24373. Transcript: 
  24374.   build/index.sml:177.4 Warning: redundant patterns in match
  24375.       VALdec vbs => ...
  24376.       VALRECdec rvbs => ...
  24377.       TYPEdec tbs => ...
  24378.       DATATYPEdec {datatycs=datatycs,withtycs=withtycs} => ...
  24379.       ABSTYPEdec {abstycs=abstycs,body=body,withtycs=withtycs} => ...
  24380.       EXCEPTIONdec ebs => ...
  24381.       STRdec sbs => ...
  24382.       ABSdec sbs => ...
  24383.       FCTdec fbs => ...
  24384.       SIGdec sigvars => ...
  24385.       LOCALdec (inner,outer) => ...
  24386.       SEQdec decs => ...
  24387.       OPENdec strVars => ...
  24388.       MARKdec (dec,L1,L2) => ...
  24389.       FIXdec _ => ...
  24390.       OVLDdec _ => ...
  24391.       IMPORTdec _ => ...
  24392.     -->   _ => ...
  24393.   translate/translate.sml:259.30 Warning: redundant patterns in match
  24394.       VALtrans (PATH p) => ...
  24395.       VALtrans (INLINE POLYEQL) => ...
  24396.       VALtrans (INLINE POLYNEQ) => ...
  24397.       VALtrans (INLINE INLSUBSCRIPT) => ...
  24398.       VALtrans (INLINE INLUPDATE) => ...
  24399.       VALtrans (INLINE INLBYTEOF) => ...
  24400.       VALtrans (INLINE INLSTORE) => ...
  24401.       VALtrans (INLINE INLORDOF) => ...
  24402.       VALtrans (INLINE INLFSUBSCRIPTd) => ...
  24403.       VALtrans (INLINE INLFUPDATEd) => ...
  24404.       VALtrans (INLINE i) => ...
  24405.       THINtrans (PATH p,v,locs) => ...
  24406.       CONtrans (d as DATACON {const=true,...}) => ...
  24407.       CONtrans (d as DATACON {const=false,...}) => ...
  24408.       VALtrans a => ...
  24409.       THINtrans (a,_,_) => ...
  24410.     -->   _ => ...
  24411.  
  24412.   cps/cpsopt.sml:1129.4 Warning: redundant patterns in match
  24413.       RECORD (vl,w,e) => ...
  24414.       SELECT (i,v,w,e) => ...
  24415.       OFFSET (i,v,w,e) => ...
  24416.       APP (f,vl) => ...
  24417.       FIX (l,e) => ...
  24418.       SWITCH (v,_,el) => ...
  24419.       BRANCH (_,vl,c,e1,e2) => ...
  24420.       LOOKER (_,vl,w,e) => ...
  24421.       SETTER (_,vl,e) => ...
  24422.       PURE (_,vl,w,e) => ...
  24423.       ARITH (args as (floor,_,_,_)) => ...
  24424.       ARITH (args as (round,_,_,_)) => ...
  24425.       ARITH (args as (fadd,_,_,_)) => ...
  24426.       ARITH (args as (fdiv,_,_,_)) => ...
  24427.       ARITH (args as (fmul,_,_,_)) => ...
  24428.       ARITH (args as (fsub,_,_,_)) => ...
  24429.       ARITH (_,vl,w,e) => ...
  24430.     -->   PURE (args as (fnegd,v :: nil,w,e)) => ...
  24431.     -->   PURE (real,vl,w,e) => ...
  24432. Status: Fixed in 0.81
  24433. ----------------------------------------------------------------------
  24434. 523. printing uncaught exceptions
  24435. Submitter:      Richard O'Neill <richard@smaug.questor.wimsey.bc.ca>
  24436. Date:        Thu Feb 27 14:32:47 PST 1992
  24437. Version:        0.75
  24438. System:         NeXTstation, OS2.1
  24439. Severity:       Major annoyance
  24440. Problem:        
  24441. If a value happens to be of type exn, the top level loop won't
  24442. print out the value, but instead says 'val it = exn : exn'; this
  24443. is not acceptable behaviour in my opinion.
  24444.  
  24445. When debugging, I like to be able to pass back information when an
  24446. fatal exception is raised. It is bad enough that if you have:
  24447.  
  24448.     exception InvalidKey of int;
  24449.   ...
  24450.     raise InvalidKey 6502;
  24451.  
  24452. it gives the message
  24453.  
  24454.     uncaught exception InvalidKey
  24455. and not:
  24456.     uncaught exception: InvalidKey 6502
  24457.  
  24458. (But the 'Io' exception does 'do the right thing'- special case
  24459. treatment or what :o)
  24460.  
  24461. But I can put up with that - what really annoys me is that even
  24462. the top level won't print exception values, i.e.
  24463.  
  24464.     - val theException = InvalidKey 6502;
  24465.     val theException = exn : exn
  24466.  
  24467. In order to find the value, I need to do:
  24468.  
  24469.     - case theException of InvalidKey key => key;
  24470.     std_in:3.1-3.42 Warning: match not exhaustive
  24471.         InvalidKey key => ...
  24472.     val it = 6502 : int
  24473.  
  24474. This is annoying, because it means more work for me to do, especially
  24475. if the datastructure is a *chain* of exception values (e.g. something
  24476. like 'exception ReraiseBacktrace of functionName * parameters *
  24477. exn' - you get the idea anyway). In such a case, I have to follow
  24478. the chain *by hand*.
  24479.  
  24480. I realise that printing exeptions may be harder than printing
  24481. ordinary constructors, but don't think this is a good reason not
  24482. to print them.
  24483.  
  24484. [Richard O'Neill, 11/24/92]
  24485. Standard ML of New Jersey, Version 0.92, November 18, 1992
  24486. val it = () : unit
  24487. - val some_exceptions = [Interrupt, Match, Bind, Io "Foobar"];
  24488. val some_exceptions = [exn,exn,exn,exn] : exn list
  24489. - ^D
  24490.  
  24491. If a value happens to be of the exception type, it is always printed
  24492. in a most uninformative way.
  24493.  
  24494. Obviously, I'd like to see:
  24495.  
  24496. Standard ML of New Jersey, Version 0.93, February 17, 1993 ;-)
  24497. val it = () : unit
  24498. - val some_exceptions = [Interrupt, Match, Bind, Io "Foobar"];
  24499. val some_exceptions = [Interrupt, Match, Bind, Io "Foobar"] : exn list
  24500. - ^D
  24501.  
  24502. Thus bug already has a number, 523, but the title "printing uncaught
  24503. exceptions" is misleading, and I expect probably the reason it hasn't
  24504. been fixed (yet). (Better printing of uncaught exceptions would be nice
  24505. too, but that is far less important to me).
  24506.  
  24507. Unless I'm seriously mistaken, this bug would only take minutes to fix, for
  24508. someone who knows SML-NJ's data-structures.
  24509.  
  24510. Comment: (awa)
  24511. Fixed a little bit; exn values now print a top level, but not the
  24512. value carried by the constructor.
  24513.  
  24514. Status: not entirely a bug
  24515. ----------------------------------------------------------------------
  24516. 524. weak polymorphism
  24517. Submitter: shail@au-bon-pain.lcs.mit.edu (Shail Aditya)
  24518. Date: 12/19/91
  24519. Version: ?
  24520. Severity: major
  24521. Problem: 
  24522.       I ran across this quirk in the ranked weak type inference in
  24523.   SML-NJ. I am running the version 0.75 on Sparc (sunos). 
  24524.  
  24525.   - val g3 = (fn f => (fn x => f x));
  24526.   val g3 = fn : ('a -> 'b) -> 'a -> 'b
  24527.  
  24528.   - g3 ref;
  24529.   std_in:5.1-5.6 Error: nongeneric weak type variable
  24530.     it : '0Z -> '0Z ref
  24531.   -
  24532.  
  24533.   The "ref" does not happen until another argument is supplied to "g3
  24534.   ref", so proper ranking analysis should have made its type to be 
  24535.   "'1a -> '1a ref" without any error.
  24536.  
  24537.   - val g = (fn x => x);
  24538.   val g = fn : 'a -> 'a
  24539.   - g ref;
  24540.   std_in:3.1-3.5 Error: nongeneric weak type variable
  24541.     it : '0Z -> '0Z ref
  24542.  
  24543.   But the following works.
  24544.  
  24545.   - val h = (fn x => let val g = fn x => x in g ref end);
  24546.   val h = fn : 'a -> '1b -> '1b ref
  24547.   -  val h = (fn x => let val g = (fn f => (fn x => f x)) in g ref end);
  24548.   val h = fn : 'a -> '1b -> '1b ref
  24549.   - 
  24550.  
  24551.   Basically, it seems that "ref" is opened up to the enclosing lambda
  24552.   rank unnecessarily when it is passed as an argument. This system works
  24553.   fine in first order situations but fails in higher order argument
  24554.   passing when the arguments are weakly polymorphic functions. 
  24555.  
  24556.   Am I to understand that the ranked system of SML-NJ is not powerful
  24557.   enough to keep track of weak polymorphism across higher order function
  24558.   applications? Or is this merely a bug? 
  24559.  
  24560.   I would like to obtain a clearer description of the ranked system you
  24561.   follow. Preferably in terms of a paper that gives the inference rules.
  24562.   I have a system that behaves similarly, only that it allows toplevel
  24563.   non-ground weak types as well. I would like to know the SML-NJ
  24564.   solution better. Do you have any pointers? 
  24565. Status: not a bug (a "feature" of weak polymorphism)
  24566. ----------------------------------------------------------------------
  24567. 525. IO.execute broken
  24568. Submitter:    Mikael Pettersson, mpe@ida.liu.se
  24569. Date:        Jan 7, 1992
  24570. Version:    0.75
  24571. System:        SPARCstation ELC, SunOS 4.1.1
  24572. Severity:    major
  24573. Problem:    the input stream from IO.execute is unusable:
  24574.         can_input and close_in fail with exceptions,
  24575.         input causes a segmentation violation
  24576. Transcript:
  24577.   ====
  24578.   - val (is,_) = execute("/bin/echo",["foo"]);
  24579.   val is = - : instream
  24580.   - close_in is;
  24581.  
  24582.   uncaught exception Io "close_in "<pipe_in>": close failed, Bad file number"
  24583.   ====
  24584.   - val (is,_) = execute("/bin/echo",["foo"]);
  24585.   val is = - : instream
  24586.   - input(is,1);
  24587.   Segmentation fault (core dumped)
  24588.   ====
  24589.   - val (is,_) = execute("/bin/echo",["foo"]);
  24590.   val is = - : instream
  24591.   - can_input is;
  24592.  
  24593.   uncaught exception SystemCall
  24594.   - (can_input is) handle (System.Unsafe.CInterface.SystemCall s) => (print s; print "\n"; 999);
  24595.   fionread failed, Bad file number
  24596.   val it = 999 : int
  24597. Status: fixed in 0.84
  24598. ----------------------------------------------------------------------
  24599. 526. Harlequin gripes
  24600. Submitter: Andrew Tolmach
  24601. Date: 3/2/92
  24602. Version: 0.75
  24603. Severity: minor
  24604. Problem: 
  24605.   1) If one uses polymorphic equality on, say, integer types, the equality test
  24606.   is much slower than using a type-specific equality operator.  This was probably
  24607.   in the context of functors, in which case its no big surprise, but might
  24608.   bear looking into further.
  24609.  
  24610.   2) They were unhappy with the time cost of referencing elements out of
  24611.   structures at runtime.  They often do something like inserting an explicit
  24612.   declaration
  24613.  
  24614.     val thing = A.thing
  24615.  
  24616.   same thing for them automatically.  They also suggested that we don't tend
  24617.   to notice this problem because we use "open" all over the place, a practice
  24618.   they abominate.
  24619. Status: not a bug
  24620. ----------------------------------------------------------------------
  24621. 527. uncaught exception Subscript while printing value of a datatype
  24622. Submitter: John Reppy
  24623. Date: 3/9/92
  24624. Version: 0.78
  24625. Severity: major
  24626. Problem: 
  24627.   compiling following code causes uncaught exception Subscript
  24628. Code: 
  24629. (* string-util.sml
  24630.  *
  24631.  * Various string utilities.
  24632.  *)
  24633.  
  24634. structure StringUtil =
  24635.   struct
  24636.  
  24637.     datatype relation_t = Equal | LessTh | GreaterTh
  24638.  
  24639.   (* lexically compare two strings and return their relation *)
  24640.     fun strcmp (s1, s2) = (case (size s1, size s2)
  24641.        of (0, 0) => Equal
  24642.         | (0, _) => LessTh
  24643.             | (_, 0) => GreaterTh
  24644.             | (n1, n2) => let
  24645.         fun loop i = let
  24646.               val c1 = ordof(s1, i) and c2 = ordof(s2, i)
  24647.                       in
  24648.                          if (c1 = c2)
  24649.                            then loop(i+1)
  24650.                          else if (c1 < c2)
  24651.                            then LessTh
  24652.                            else GreaterTh
  24653.                       end
  24654.                 in
  24655.                   (loop 0) handle _ => (
  24656.                      if (n1 = n2)
  24657.                        then Equal
  24658.                      else if (n1 < n2)
  24659.                        then LessTh
  24660.                        else GreaterTh)
  24661.         end (* strcmp *)
  24662.         (* end case *))
  24663.  
  24664.   (* Lexically sort a list of values with unique string keys.  The function
  24665.    * proj extracts the key of an item.  Raise Repeat if two items have the
  24666.    * same key.
  24667.    *)
  24668.     exception Repeat of string
  24669.     fun sortStrings proj = let
  24670.       fun le (f1, f2) = (case strcmp(proj f1, proj f2)
  24671.          of LessTh => true
  24672.           | GreaterTh => false
  24673.           | Equal => raise Repeat(proj f1)
  24674.         (* end case *))
  24675.       fun insert (f, []) = [f]
  24676.         | insert (f, l as (f'::r)) =
  24677.         if le(f, f') then f::l else f'::insert(f, r)
  24678.       fun sort ([], l) = l
  24679.         | sort (f::r, l) = sort(r, insert(f, l))
  24680.       in
  24681.         fn l => sort (l, [])
  24682.       end
  24683.  
  24684.   end (* StringUtil *)
  24685.  
  24686. (* this is a SML implementation of Luca's Amber code *)
  24687.  
  24688. (* Types are represented by values in the following type.  Rec bound variables
  24689.  * in a recursive type are represented by the RecTy node in which they are bound.
  24690.  * For example, the representation of the following Amber type
  24691.  *
  24692.  *   rec (t) [nil : Unit, cons : {hd : Int, tl : t}]
  24693.  *
  24694.  * is constructed by the following ML code:
  24695.  *
  24696.  * let
  24697.  *   val recBody = ref Any
  24698.  *   val recTy = RecTy{bind = "t", typ = recBody}
  24699.  *   val body = VariantTy[
  24700.  *           FieldTy{tag = "nil", typ = BaseTy UnitTy},
  24701.  *           FieldTy{tag = "cons", typ = RecordTy[
  24702.  *               FieldTy{tag = "hd", typ = BaseTy IntTy},
  24703.  *               FieldTy{tag = "tl", typ = recTy},
  24704.  *             ]
  24705.  *         ]
  24706.  * in
  24707.  *   recBody := body;
  24708.  *   recTy
  24709.  * end
  24710.  *)
  24711.  
  24712. datatype base_ty = UnitTy | BoolTy | IntTy | StringTy | DynamicTy
  24713.  
  24714. datatype typ
  24715.   = AnyTy
  24716. (*  | ExistTy of {name : string, instance : typ option, suptypes : typ list}*)
  24717.   | BaseTy of base_ty
  24718.   | FunTy of (typ * typ)
  24719.   | TupleTy of typ list
  24720.   | RecordTy of field_ty list        (* assume fields are sorted by tag *)
  24721.   | VariantTy of field_ty list
  24722.   | RecTy of {bind : string, typ : typ ref}
  24723.   | ArrayTy of typ
  24724.   | ChannelTy of typ
  24725. and field_ty = FieldTy of {tag : string, typ : typ}
  24726.  
  24727. fun seen (stk, ty1 : typ, ty2 : typ) = let
  24728.       val x = (ty1, ty2)
  24729.       fun look [] = false
  24730.     | look (y::r) = (x = y) orelse look r
  24731.       in
  24732.     look stk
  24733.       end
  24734.  
  24735. (* return true if the types are "equal" *)
  24736. fun sameType (ty1, ty2) = let
  24737.       fun sameTy (AnyTy, _, _) = true
  24738.     | sameTy (_, AnyTy, _) = true
  24739.     | sameTy (BaseTy b1, BaseTy b2, _) = (b1 = b2)
  24740.     | sameTy (FunTy(t1, s1), FunTy(t2, s2), stk) =
  24741.         sameTy(t1, t2, stk) andalso sameTy(s1, s2, stk)
  24742.     | sameTy (TupleTy tl1, TupleTy tl2, stk) = let
  24743.         fun sameTyList ([], []) = true
  24744.           | sameTyList (ty1::r1, ty2::r2) =
  24745.           sameTy(ty1, ty2, stk) andalso sameTyList(r1, r2)
  24746.         in
  24747.           sameTyList(tl1, tl2)
  24748.         end
  24749.     | sameTy (RecordTy fl1, RecordTy fl2, stk) = sameFieldList (fl1, fl2, stk)
  24750.     | sameTy (VariantTy fl1, VariantTy fl2, stk) = sameFieldList (fl1, fl2, stk)
  24751.     | sameTy (ty1 as RecTy{typ=ty1', ...}, ty2 as RecTy{typ=ty2', ...}, stk) =
  24752.         (ty1' = ty2')
  24753.         orelse seen(stk, ty1, ty2)
  24754.         orelse sameTy(!ty1', !ty2', (ty1, ty2)::stk)
  24755.     | sameTy (ty1 as RecTy{typ, ...}, ty2, stk) =
  24756.         seen(stk, ty1, ty2) orelse sameTy(!typ, ty2, (ty1, ty2)::stk)
  24757.     | sameTy (ty1, ty2 as RecTy{typ, ...}, stk) =
  24758.         seen(stk, ty1, ty2) orelse sameTy(ty1, !typ, (ty1, ty2)::stk)
  24759.     | sameTy (ArrayTy ty1, ArrayTy ty2, stk) = sameTy(ty1, ty2, stk)
  24760.     | sameTy (ChannelTy ty1, ChannelTy ty2, stk) = sameTy(ty1, ty2, stk)
  24761.     | sameTy _ = false
  24762.       and sameFieldList ([], [], _) = true
  24763.     | sameFieldList (FieldTy{tag=a, typ=t}::r1, FieldTy{tag=b, typ=s}::r2, stk) =
  24764.         (a = b) andalso sameTy(t, s, stk) andalso sameFieldList(r1, r2, stk)
  24765.     | sameFieldList _ = false
  24766.       in
  24767.     sameTy (ty1, ty2, [])
  24768.       end
  24769.  
  24770. (* return true, if ty1 is a subtype of ty2 *)
  24771. fun isSubtyOf (ty1, ty2) = let
  24772.       exception TypeError
  24773.     (* given two sorted lists of field types, where the second should contain all of
  24774.      * tags of the first list, return the projection of those fields from the second
  24775.      * list.
  24776.      *)
  24777.       fun projFieldList (fl1, fl2) = let
  24778.         fun proj ([], _, l) = rev l
  24779.           | proj (_, [], _) = raise TypeError
  24780.           | proj (
  24781.           l1 as (FieldTy{tag=a, ...}::r1),
  24782.           l2 as ((f as FieldTy{tag=b, ...})::r2), l
  24783.         ) = (
  24784. print(implode["proj: a = ", a, ", b = ", b, "\n"]);
  24785.           case (StringUtil.strcmp(a, b))
  24786.            of StringUtil.Equal => proj (r1, r2, f::l)
  24787.             | StringUtil.GreaterTh => proj (l1, r2, l)
  24788.             | StringUtil.LessTh => proj (r1, l2, l)
  24789.           (* end case *))
  24790.         in
  24791.           proj (fl1, fl2, [])
  24792.         end
  24793.       fun subTy (AnyTy, _, _) = true
  24794.     | subTy (_, AnyTy, _) = true
  24795.     | subTy (BaseTy b1, BaseTy b2, _) = (b1 = b2)
  24796.     | subTy (ty1 as RecTy{typ=ty1', ...}, ty2 as RecTy{typ=ty2', ...}, stk) =
  24797.         (ty1' = ty2')
  24798.         orelse seen(stk, ty1, ty2)
  24799.         orelse subTy(!ty1', !ty2', (ty1, ty2)::stk)
  24800.     | subTy (ty1 as RecTy{bind, typ}, ty2, stk) =
  24801.         seen(stk, ty1, ty2) orelse subTy(!typ, ty2, (ty1, ty2)::stk)
  24802.     | subTy (ty1, ty2 as RecTy{bind, typ}, stk) =
  24803.         seen(stk, ty1, ty2) orelse subTy(ty1, !typ, (ty1, ty2)::stk)
  24804.     | subTy (FunTy(ty1, ty2), FunTy(ty1', ty2'), stk) =
  24805.         subTy(ty1', ty1, stk) andalso subTy(ty2, ty2', stk)
  24806.     | subTy (TupleTy tl1, TupleTy tl2, stk) = let
  24807.         fun subTyList ([], []) = true
  24808.           | subTyList (t1::r1, t2::r2) =
  24809.           subTy(t1, t2, stk) andalso subTyList(r1, r2)
  24810.           | subTyList _ = false
  24811.         in
  24812.           subTyList(tl1, tl2)
  24813.         end
  24814.     | subTy (RecordTy f1, RecordTy f2, stk) = let
  24815.         val f1' = projFieldList (f2, f1)
  24816.         in
  24817.           subFieldList (f1', f2, stk)
  24818.         end
  24819.     | subTy (VariantTy f1, VariantTy f2, stk) = let
  24820.         val f2' = projFieldList (f1, f2)
  24821.         in
  24822.           subFieldList (f1, f2', stk)
  24823.         end
  24824.     | subTy (ArrayTy ty1, ArrayTy ty2, _) = sameType(ty1, ty2)
  24825.     | subTy (ChannelTy ty1, ChannelTy ty2, _) = sameType(ty1, ty2)
  24826.     | subTy _ = false
  24827.     (* this should only be called on field lists that have the same tags *)
  24828.       and subFieldList ([], [], _) = true
  24829.     | subFieldList (FieldTy{typ=t, ...}::r1, FieldTy{typ=s, ...}::r2, stk) =
  24830.         subTy(t, s, stk) andalso subFieldList(r1, r2, stk)
  24831.       in
  24832.     (subTy (ty1, ty2, [])) handle TypeError => false
  24833.       end
  24834.  
  24835. fun revApp ([], l) = l
  24836.   | revApp (x::r, l) = revApp(r, x::l)
  24837.  
  24838. (* Return the union of two field lists, with f mapped over their intersection. *)
  24839. fun unionFieldMap f = let
  24840.       fun union ([], [], l) = revApp (l, [])
  24841.     | union ([], l2, l) = revApp (l, l2)
  24842.     | union (l1, [], l) = revApp (l, l1)
  24843.     | union (
  24844.         l1 as ((f1 as FieldTy{tag=a, typ=t1})::r1),
  24845.         l2 as ((f2 as FieldTy{tag=b, typ=t2})::r2), l
  24846.       ) = (case (StringUtil.strcmp(a, b))
  24847.          of StringUtil.Equal =>
  24848.           union (r1, r2, FieldTy{tag = a, typ = f(t1, t2)}::l)
  24849.           | StringUtil.GreaterTh => union (l1, r2, f2::l)
  24850.           | StringUtil.LessTh => union (r1, l2, f1::l)
  24851.         (* end case *))
  24852.       in
  24853.     fn (fl1, fl2) => union (fl1, fl2, [])
  24854.       end
  24855.  
  24856. (* Map f over the intersection of two field lists *)
  24857. fun interFieldMap f = let
  24858.       fun inter ([], _, l) = revApp (l, [])
  24859.     | inter (_, [], l) = revApp (l, [])
  24860.     | inter (
  24861.         l1 as (FieldTy{tag=a, typ=t1}::r1),
  24862.         l2 as (FieldTy{tag=b, typ=t2}::r2), l
  24863.       ) = (case (StringUtil.strcmp(a, b))
  24864.          of StringUtil.Equal =>
  24865.           inter (r1, r2, FieldTy{tag = a, typ = f(t1, t2)}::l)
  24866.           | StringUtil.GreaterTh => inter (r1, l2, l)
  24867.           | StringUtil.LessTh => inter (l1, r2, l)
  24868.         (* end case *))
  24869.       in
  24870.     fn (fl1, fl2) => inter (fl1, fl2, [])
  24871.       end
  24872.  
  24873. exception Join
  24874. fun joinTy (AnyTy, _) = AnyTy
  24875.   | joinTy (_, AnyTy) = AnyTy
  24876.   | joinTy (ty as BaseTy b1, BaseTy b2) =
  24877.       if (b1 = b2) then ty else raise Join
  24878.   | joinTy (TupleTy tl1, TupleTy tl2) = let
  24879.       fun joinTyList ([], []) = []
  24880.     | joinTyList ([], _) = raise Join
  24881.     | joinTyList (_, []) = raise Join
  24882.     | joinTyList (ty1::r1, ty2::r2) = joinTy(ty1, ty2) :: joinTyList(r1, r2)
  24883.       in
  24884.     TupleTy(joinTyList (tl1, tl2))
  24885.       end
  24886.   | joinTy (FunTy(ty1, ty2), FunTy(ty1', ty2')) =
  24887.       FunTy(meetTy (ty1, ty1'), joinTy (ty2, ty2'))
  24888.   | joinTy (RecordTy fl1, RecordTy fl2) =
  24889.       RecordTy (interFieldMap joinTy (fl1, fl2))
  24890.   | joinTy (VariantTy fl1, VariantTy fl2) =
  24891.       VariantTy (unionFieldMap joinTy (fl1, fl2))
  24892. and meetTy (AnyTy, _) = AnyTy
  24893.   | meetTy (_, AnyTy) = AnyTy
  24894.   | meetTy (ty as BaseTy b1, BaseTy b2) =
  24895.       if (b1 = b2) then ty else raise Join
  24896.   | meetTy (TupleTy tl1, TupleTy tl2) = let
  24897.       fun meetTyList ([], []) = []
  24898.     | meetTyList ([], _) = raise Join
  24899.     | meetTyList (_, []) = raise Join
  24900.     | meetTyList (ty1::r1, ty2::r2) = meetTy(ty1, ty2) :: meetTyList(r1, r2)
  24901.       in
  24902.     TupleTy(meetTyList (tl1, tl2))
  24903.       end
  24904.   | meetTy (FunTy(ty1, ty2), FunTy(ty1', ty2')) =
  24905.       FunTy(joinTy (ty1, ty1'), meetTy (ty2, ty2'))
  24906.   | meetTy (RecordTy fl1, RecordTy fl2) =
  24907.       RecordTy (unionFieldMap meetTy (fl1, fl2))
  24908.   | meetTy (VariantTy fl1, VariantTy fl2) =
  24909.       VariantTy (interFieldMap meetTy (fl1, fl2))
  24910.  
  24911.  
  24912. (**** Test code ***)
  24913.  
  24914. fun mkRecTy (id, mkTy) = let
  24915.       val recBody = ref AnyTy
  24916.       val recTy = RecTy{bind = id, typ = recBody}
  24917.       in
  24918.     recBody := mkTy(recTy);
  24919.     recTy
  24920.       end
  24921. fun mkVar1 (tag, ty) = VariantTy[FieldTy{tag = tag, typ = ty}]
  24922. val unitTy = BaseTy UnitTy
  24923. val intTy = BaseTy IntTy
  24924.  
  24925. (* rec (t) [nil : Unit, cons : {hd : Int, tl : t}] *)
  24926. val intListTy = mkRecTy("t",
  24927.       fn recTy => VariantTy[
  24928.               FieldTy{tag = "nil", typ = unitTy},
  24929.               FieldTy{tag = "cons", typ = RecordTy[
  24930.                   FieldTy{tag = "hd", typ = intTy},
  24931.                   FieldTy{tag = "tl", typ = recTy}
  24932.                 ]}
  24933.             ])
  24934.  
  24935. (* [cons : {hd : Int, tl : [nil : Unit]}] *)
  24936. val intListTy' = VariantTy[
  24937.         FieldTy{tag = "cons", typ = RecordTy[
  24938.             FieldTy{tag = "hd", typ = intTy},
  24939.             FieldTy{tag = "tl", typ = VariantTy[
  24940.         FieldTy{tag = "nil", typ = unitTy}
  24941.           ]}
  24942.           ]}
  24943.       ]
  24944. ====
  24945. The following shorter example causes an uncaught subscript in 0.77 & 0.78 (but
  24946. not in 0.77b):
  24947.  
  24948.   datatype tree = Leaf of int | Plus of (tree * tree * int);
  24949.   (Plus (Leaf 0,Leaf 1,2),2);
  24950.  
  24951. for example:
  24952.  
  24953.   Standard ML of New Jersey, Version 0.78, February 26, 1992
  24954.   Arrays have changed; see Release Notes
  24955.   val it = () : unit
  24956.   - datatype tree = Leaf of int | Plus of (tree * tree * int);
  24957.   datatype  tree
  24958.   con Leaf : int -> tree
  24959.   con Plus : tree * tree * int -> tree
  24960.   - (Plus (Leaf 0,Leaf 1,2),2);
  24961.   val it = (Plus (
  24962.   uncaught exception Subscript
  24963.   - 
  24964. Comment: 
  24965.   Bug appeared between 0.77b and 0.77.  Possibly related to change
  24966.   in dataconstructor representations.
  24967.  
  24968. Submitter:      Andrzej Filinski <andrzej@cs.cmu.edu>
  24969. Date:        March 19, 1992
  24970. Version:        0.78
  24971. System:         All
  24972. Severity:       Major
  24973. Problem:        Printing certain datatype values raises Subscript
  24974. Transcript:     Standard ML of New Jersey, Version 0.78, February 26, 1992
  24975.         Arrays have changed; see Release Notes
  24976.         val it = () : unit
  24977.         - datatype foo = BAR of int | BAZ of foo * foo;
  24978.         datatype  foo
  24979.         con BAR : int -> foo
  24980.         con BAZ : foo * foo -> foo
  24981.         - BAZ (BAR 1, BAR 2);
  24982.         val it = BAZ (
  24983.         uncaught exception Subscript
  24984.         -
  24985.   [Bob Harper, 4/10/92]:
  24986.   Dave Tarditi suggested that the constructor printing problem might be due to
  24987.   the fact that something or other got reversed in the code generator, but this
  24988.   was forgotten in the print routines.  Apparently some representation is now
  24989.   done in reverse order.
  24990.  
  24991.   I consistently get the following behavior:
  24992.   1. Build a system using SourceGroup.make.
  24993.   2. Open a particular structure, making available a constructor Abs (among
  24994.      many others).
  24995.   3. Modify things, do another make.
  24996.   4. Uses of Abs suddenly get weird type errors.  Typing Abs at top level
  24997.      results in "val it = exn : exn".
  24998.  
  24999.   I could send the whole system, but this seems excessive....
  25000. Status: fixed in 0.84
  25001. ----------------------------------------------------------------------
  25002. 528. Compiler bug: ModuleUtil.teststr 2
  25003. Submitter:      Ian Green, aisb@ed.ac.uk
  25004. Date:        18-Mar-92
  25005. Version:        0.75
  25006. System:         Sun SPARC 1+, SunOS 4.1
  25007. Severity:       john major
  25008. Problem:        Error: Compiler bug: ModuleUtil.teststr 2
  25009. Code:           
  25010.  
  25011. ************ UnifyFUN.sml *************
  25012. import "TermsSIG";
  25013. import "UnifySIG";
  25014.  
  25015. functor Unifier(structure Terms:TERMS):UNIFY = 
  25016.     struct
  25017.     local
  25018.         open Terms
  25019.         fun unifyst _ _ _ = []
  25020.     in
  25021.         fun mgu t1 t2 = unifyst [] [(t1,t2)] []
  25022.         handle No_Unifier => []
  25023.     end
  25024.     end
  25025. ****************************************
  25026.  
  25027. ************ UnifySIG.sml **************
  25028. import "TermsSIG";
  25029.  
  25030. signature UNIFY =
  25031.     sig
  25032.     local
  25033.         structure Terms:TERMS
  25034.         open Terms
  25035.     in
  25036.         val mgu : Terms.term -> Terms.term -> (Terms.atom * Terms.term) list
  25037.     end
  25038.     end
  25039. *****************************************
  25040.  
  25041. ********** TermsSIG.sml ***************
  25042. signature TERMS =
  25043.     sig
  25044.     datatype atom = Var of string 
  25045.       |  Const of string
  25046.     datatype term =
  25047.         Atomic of atom
  25048.       | Term of atom * term list
  25049.       | WhereTerm of atom list * term * term;
  25050.     val subst : atom list -> (atom * term) list -> term -> term
  25051.     end;
  25052. ****************************************
  25053.     
  25054. ************ TermsFUN.sml *************
  25055. import "TermsSIG";
  25056.  
  25057. functor Terms( ):TERMS =
  25058.     struct
  25059.     datatype atom = Var of string 
  25060.       |  Const of string
  25061.     datatype term =
  25062.         Atomic of atom
  25063.       | Term of atom * term list
  25064.       | WhereTerm of atom list * term * term;
  25065.     fun subst _ _ t = t (* i like this case *)
  25066.     end;
  25067. ****************************************
  25068.  
  25069. ************ load ******************
  25070. import "TermsFUN";
  25071. import "UnifyFUN";
  25072.  
  25073. structure Term = Terms( );
  25074.  
  25075. structure Unify = Unifier(structure Terms = Term);
  25076. ****************************************
  25077.  
  25078. Transcript: 
  25079.  
  25080. In summary, I do three `use "load"' starting with no bin files.  The
  25081. first gives no error, but i get <erro> types (what does that mean).
  25082. Second time a recompile is needed (odd?) and get a Compiler bug:
  25083.  
  25084. On the third try, no recompile needed, but get same compiler bug
  25085. report.  Here it is in all its (gory) detail. 
  25086. ---------------------------------------------------------
  25087. Standard ML of New Jersey, Version 75, November 11, 1991
  25088. Arrays have changed; see Release Notes
  25089. val it = () : unit
  25090. - use "load";
  25091. [opening load]
  25092. [reading TermsFUN.sml]
  25093.   [reading TermsSIG.sml]
  25094.   [writing TermsSIG.bin... done]
  25095.   [closing TermsSIG.sml]
  25096. [writing TermsFUN.bin... done]
  25097. [closing TermsFUN.sml]
  25098. functor Terms
  25099. signature TERMS
  25100. [reading UnifyFUN.sml]
  25101.   [reading TermsSIG.bin... done]
  25102.   [reading UnifySIG.sml]
  25103.     [reading TermsSIG.bin... done]
  25104. UnifySIG.sml:6.6-8.1 Warning: LOCAL specs are only partially implemented
  25105.   [writing UnifySIG.bin... done]
  25106.   [closing UnifySIG.sml]
  25107. [writing UnifyFUN.bin... done]
  25108. [closing UnifyFUN.sml]
  25109. functor Unifier
  25110. signature UNIFY
  25111. signature TERMS
  25112. structure Term :
  25113.   sig
  25114.     datatype atom
  25115.       con Const : string -> atom
  25116.       con Var : string -> atom
  25117.     datatype term
  25118.       con Atomic : atom -> term
  25119.       con Term : atom * term list -> term
  25120.       con WhereTerm : atom list * term * term -> term
  25121.     val subst : atom list -> (atom * term) list -> term -> term
  25122.   end
  25123.  
  25124. structure Unify : UNIFY
  25125. [closing load]
  25126. val it = () : unit
  25127. - Unify.mgu;
  25128. val it = fn : <error> -> <error> -> (<error> * <error>) list
  25129. - use "load";
  25130. [opening load]
  25131. [reading TermsFUN.bin... ]
  25132. [import(s) of TermsFUN are out of date; recompiling]
  25133. [closing TermsFUN.bin]
  25134. [reading TermsFUN.sml]
  25135.   [reading TermsSIG.bin... done]
  25136. [writing TermsFUN.bin... done]
  25137. [closing TermsFUN.sml]
  25138. functor Terms
  25139. signature TERMS
  25140. [reading UnifyFUN.bin... done]
  25141. functor Unifier
  25142. signature UNIFY
  25143. signature TERMS
  25144. structure Term :
  25145.   sig
  25146.     datatype atom
  25147.       con Const : string -> atom
  25148.       con Var : string -> atom
  25149.     datatype term
  25150.       con Atomic : atom -> term
  25151.       con Term : atom * term list -> term
  25152.       con WhereTerm : atom list * term * term -> term
  25153.     val subst : atom list -> (atom * term) list -> term -> term
  25154.   end
  25155.  
  25156. Error: Compiler bug: ModuleUtil.teststr 2
  25157. [closing load]
  25158. - use "load";
  25159. [opening load]
  25160. [reading TermsFUN.bin... done]
  25161. functor Terms
  25162. signature TERMS
  25163. [reading UnifyFUN.bin... done]
  25164. functor Unifier
  25165. signature UNIFY
  25166. signature TERMS
  25167. structure Term :
  25168.   sig
  25169.     datatype atom
  25170.       con Const : string -> atom
  25171.       con Var : string -> atom
  25172.     datatype term
  25173.       con Atomic : atom -> term
  25174.       con Term : atom * term list -> term
  25175.       con WhereTerm : atom list * term * term -> term
  25176.     val subst : atom list -> (atom * term) list -> term -> term
  25177.   end
  25178.  
  25179. Error: Compiler bug: ModuleUtil.teststr 2
  25180. [closing load]
  25181. -
  25182.  
  25183. Comments:  I see from the compiler that LOCAL specs are only partially
  25184. implemented, so this is probably the cause, though i dont get the
  25185. <error> bit.  As I am new to modules in ML, its all probably
  25186. meaningless code anyway, but I thought I ought to drop you a line.
  25187.  
  25188. Status: cannot reproduce (bug report incomplete); probably fixed.
  25189. ----------------------------------------------------------------------
  25190. 529. memory leak
  25191. Submitter: schristensen@daimi.aau.dk (Soren Christensen)
  25192. Date: 3/20/92
  25193. Version: 0.75
  25194. Severity: major
  25195. Problem: 
  25196.   I have a problem that my system slows down after running a short while.
  25197.   Instead of using the ordinary top-loop of the compiler I run my own. This
  25198.   means that I evaluate ML code in the following way:
  25199.  
  25200.   use_stream (open_string "code");
  25201.  
  25202.   It seems that this construct creates 16 bytes of "garbage" which is never
  25203.   collected.
  25204.  
  25205.   My first idea was that I needed to close the stream which is created, i.e.,
  25206.  
  25207.   let
  25208.     val is = open_string "code"
  25209.   in
  25210.    use_stream is;
  25211.    close_in is
  25212.   end;
  25213.  
  25214.   But this does not fix the problem.
  25215.  
  25216.   It seems that "close_in is" have no effect. At least it reports no errors
  25217.   when a use_string is performed on a stream which has been closed.
  25218.  
  25219. Status: fixed in 0.84
  25220. ----------------------------------------------------------------------
  25221. 530. missing space in printing abstype declaration
  25222. Submitter:      Mikael Pettersson, mpe@ida.liu.se
  25223. Date:           March 20 1992
  25224. Version:        0.75
  25225. System:         all
  25226. Severity:       minor
  25227. Problem:        when printing a polymorphic abstype, no space is inserted
  25228.                 between the "type" symbol and the type variable
  25229. Transcript:
  25230.  
  25231. - abstype 'a foo = FOO of 'a list
  25232. = with
  25233. =   fun mkfoo() = FOO []
  25234. = end;
  25235. type'a  foo        (* note: missing space after "type" *)
  25236. val mkfoo = fn : unit -> 'a foo
  25237.  
  25238. Fix:
  25239.  
  25240. --cut here--
  25241. *** src/print/printdec.sml.~1~    Fri Oct 18 23:21:13 1991
  25242. --- src/print/printdec.sml    Fri Mar 20 14:00:07 1992
  25243. ***************
  25244. *** 50,56 ****
  25245.            printSym name; print " = "; printType env def; newline())
  25246.   
  25247.       and printAbsTyc(GENtyc{path=name::_, arity, eq, kind=ref(ABStyc _), ...}) =
  25248. !         (print(if (!eq=YES) then "eqtype" else "type"); 
  25249.            printFormals arity; print " ";
  25250.            printSym name; newline())
  25251.   
  25252. --- 50,56 ----
  25253.            printSym name; print " = "; printType env def; newline())
  25254.   
  25255.       and printAbsTyc(GENtyc{path=name::_, arity, eq, kind=ref(ABStyc _), ...}) =
  25256. !         (print(if (!eq=YES) then "eqtype " else "type "); 
  25257.            printFormals arity; print " ";
  25258.            printSym name; newline())
  25259.   
  25260. --cut here--
  25261. Status: fixed in 0.86
  25262. ----------------------------------------------------------------------
  25263. 531. Compiler bug: CoreLang.makeOVERLOADdec.option
  25264. Submitter: John Reppy
  25265. Date: 3/24/92
  25266. Version: 0.78
  25267. Severity: major
  25268. Problem: 
  25269.   I noticed a "CoreLang.makeOVERLOADdec.option"
  25270.   compiler bug (this also occurs in 0.78):
  25271. Transcript: 
  25272.   <jhr@bat> cat boot/perv.sml
  25273.   structure Foo = struct
  25274.     val x = InLine.:=
  25275.   end
  25276.   <jhr@bat> smlc
  25277.   Standard ML of New Jersey, Version 0.78, February 26, 1992 (batch compiler)
  25278.   ~mBoot
  25279.   [mBoot()]
  25280.    ...
  25281.   [Compiling boot/perv.sml]
  25282.   structure Foo : ...
  25283.   [closing boot/perv.sml]
  25284.   boot/overloads.sml:4.15-4.21 Error: unbound structure Initial
  25285.   boot/overloads.sml:6.7-6.21 Error: unbound structure Bool in path Bool.makestring
  25286.   boot/overloads.sml:6.27-6.44 Error: unbound structure Integer in path Integer.makestring
  25287.   boot/overloads.sml:6.50-6.64 Error: unbound structure Real in path Real.makestring
  25288.   Error: Compiler bug: CoreLang.makeOVERLOADdec.option
  25289.   [closing boot/overloads.sml]
  25290.   [Failed on "~mBoot" with Syntax]
  25291. Comment: [dbm]
  25292.   This should never be visible to a user.
  25293. Status: not a bug
  25294. ----------------------------------------------------------------------
  25295. 532. squaring big real number dumps core on sparc (see also 638)
  25296. Submitter: rst@ai.mit.edu (Robert S. Thau)
  25297. Date: 3/24/92
  25298. Version: ?
  25299. System: Sparc
  25300. Severity: 
  25301. Problem: 
  25302.   To repeat this, just attempt to square 1.0E~160 on your nearest sparcstation
  25303.   in SML/NJ.  The process will die, complaining that "underflow should not trap".
  25304. Fix:
  25305.   As I read the source code, the machine-independant signal-handling code (in
  25306.   signal.c) expects floating point underflows not to trap, but the machine-
  25307.   dependant code does enable underflow trapping.  Accordingly, here's a
  25308.   one-line fix to SPARC.dep.c in the runtime directory:
  25309.  
  25310.   *** SPARC.dep.c    Tue Mar 24 18:08:57 1992
  25311.   --- SPARC.dep.c.~1~    Tue Aug 20 12:03:52 1991
  25312.   ***************
  25313.   *** 108,112 ****
  25314.     SETSIG (SIGILL, fpe_handler, mask);
  25315.     #endif MACH
  25316.  
  25317.   !     set_fsr (0x0d000000); /* enable FP exceptions NV, OF & DZ; disable UF */
  25318.     }
  25319.   --- 108,112 ----
  25320.     SETSIG (SIGILL, fpe_handler, mask);
  25321.     #endif MACH
  25322.  
  25323.   !     set_fsr (0x0f000000); /* enable FP exceptions NV, OF, UF & DZ */
  25324.     }
  25325. Status: fixed in 0.90
  25326. ----------------------------------------------------------------------
  25327. 533. typing record types
  25328. Submitter:      Richard O'Neill <richard@smaug.questor.wimsey.bc.ca>
  25329. Date:        Tue Mar 24 17:54:13 PST 1992
  25330. Version:        0.75 (and 0.73, don't know about 0.78)
  25331. System:         NeXTstation, OS2.1 & Sun4 SunOS 4.1.1.
  25332. Severity:       Major
  25333. Problem:        
  25334.  
  25335.  
  25336. The type system is *broken* w.r.t. record types. The problem is tied in
  25337. with use of flex records (but I do NOT mean the 'unresolved flex record
  25338. in let pattern' business that novice programmers sometimes fail to
  25339. understand).  The type checker gives an incorrect (too general) typing
  25340. for valid SML.  A very minor change causes a correct typing to be given.
  25341.  
  25342. The best way to show this bug is to give some code that reproduces it:
  25343.  
  25344.    (*
  25345.     * The compiler incorrectly types this function as:
  25346.     * {key:''a,value:'b} list -> {key:''a,value:'c} -> {key:''a,value:'b} list
  25347.     *                          ^--- should be 'b
  25348.     *)
  25349.     
  25350.  
  25351.     fun insert1 alist (item as {key=desired, ...}) =
  25352.     let                  (* ^--- remember this bit *)
  25353.         fun worker nil = item :: nil
  25354.           | worker ({key,value} :: items) =
  25355.         if key = desired then
  25356.             item :: items
  25357.         else
  25358.             worker items
  25359.     in
  25360.         (worker alist)
  25361.     end
  25362.  
  25363.    (*
  25364.     * The compiler correctly types this function as:
  25365.     * {key:''a,value:'b} list -> {key:''a,value:'b} -> {key:''a,value:'b} list
  25366.     *                          ^--- correct
  25367.     *)
  25368.     
  25369.  
  25370.     fun insert2 alist (item as {key=desired, value = _}) =
  25371.     let                  (* ^--- the only difference *)
  25372.         fun worker nil = item :: nil
  25373.           | worker ({key,value} :: items) =
  25374.         if key = desired then
  25375.             item :: items
  25376.         else
  25377.             worker items
  25378.     in
  25379.         (worker alist)
  25380.     end
  25381.  
  25382.  
  25383. Transcript:
  25384.  
  25385. unix% sml
  25386. Standard ML of New Jersey, Version 75, November 11, 1991
  25387. Arrays have changed; see Release Notes
  25388. val it = () : unit
  25389. - use "typing-bug.sml"    (* Just the source as shown above... *);
  25390. [opening typing-bug.sml]
  25391. val insert1 = fn : {key:''a,value:'b} list -> {key:''a,value:'c} -> {key:''a,value:'b} list
  25392. val insert2 = fn : {key:''a,value:'b} list -> {key:''a,value:'b} -> {key:''a,value:'b} list
  25393. [closing typing-bug.sml]
  25394. val it = () : unit
  25395. - val [{value=foo, ...}] = insert1 nil {key=17, value=100}    (* broken *)
  25396. = and [{value=bar, ...}] = insert2 nil {key=17, value=100}    (* okay   *) ;
  25397. std_in:3.1-4.56 Warning: binding not exhaustive
  25398.         {value=bar,...} :: nil = ...
  25399. std_in:3.1-4.56 Warning: binding not exhaustive
  25400.         {value=foo,...} :: nil = ...
  25401. val foo = - : 'a
  25402. val bar = 100 : int
  25403. - foo : int;
  25404. val it = 100 : int
  25405. - foo : string;
  25406. val it = "d" : string
  25407. - foo : real;            (* This one's cruel, I know... *)
  25408. Bus error (core dumped)
  25409. unix%
  25410. Comment:
  25411.   In practice, it isn't to much of a problem as one can always restrict
  25412.   the type or use the form that types correctly. Even so, it does reflect
  25413.   a problem in the type checker and ought to be fixed.
  25414. Status: fixed in 0.85
  25415. ----------------------------------------------------------------------
  25416. 534. .bin files for share and noshare compiler incompatible
  25417. Submitter: Bernard Sufrin
  25418. Date: 3/24/92
  25419. Version: 0.75
  25420. System: Sparc/SUNOS 4.1.1
  25421. Severity: minor
  25422. Problem: 
  25423.   I have a good deal of evidence that .bin files compiled by the shared
  25424.   compiler and those compiled by the unshared compiler are incompatible.
  25425.   Shared compiler generated .bin files cause the unshared compiler
  25426.   to crash with a bus error, and vice versa.
  25427. Status: open
  25428. ----------------------------------------------------------------------
  25429. 535. Problems with non-equality types (bug or language problem?) (see also 341)
  25430. Submitter:      Richard O'Neill <richard@smaug.questor.wimsey.bc.ca>
  25431. Date:        Wed Mar 25 09:41:51 PST 1992
  25432. Version:        0.75 (and 0.73, don't know about 0.78)
  25433. System:         NeXTstation, OS2.1 & Sun4 SunOS 4.1.1.
  25434. Severity:       Major
  25435. Problem:        
  25436.  
  25437. I'm not sure if this is a bug or a language 'feature' - whatever it is,
  25438. it is certainly unnecessarily restrictive and needs fixing...
  25439.  
  25440. If I have a reference to a type that does not admit equality, I can
  25441. still test  *references* to that type for equality. But, if that reference
  25442. is wrapped up as part of a structured type, I cannot.
  25443.  
  25444. It isn't necessarily tied to references. It also applies to any parametric
  25445. types which don't actually contain an element of the type, such as:
  25446.     datatype 'a type_only = TypeOnly
  25447.  
  25448. Take a look at the transcript below...
  25449.  
  25450. Transcript:
  25451.  
  25452. Standard ML of New Jersey, Version 75, November 11, 1991
  25453. Arrays have changed; see Release Notes
  25454. val it = () : unit
  25455. - abstype abstract = Abstract with val abstract = Abstract end;
  25456. type abstract
  25457. val abstract = - : abstract
  25458. - val abstract_ref = ref abstract;
  25459. val abstract_ref = ref - : abstract ref
  25460. - abstract_ref = abstract_ref;
  25461. val it = true : bool
  25462. -
  25463. - datatype 'a wrapped_ref = WrappedRef of 'a ref;
  25464. datatype 'a  wrapped_ref
  25465. con WrappedRef : 'a ref -> 'a wrapped_ref
  25466. - val wrapped_abstract_ref = WrappedRef (abstract_ref);
  25467. val wrapped_abstract_ref = WrappedRef (ref -) : abstract wrapped_ref
  25468. - wrapped_abstract_ref = wrapped_abstract_ref;
  25469. std_in:7.1-7.43 Error: operator and operand don't agree (equality type required)
  25470.   operator domain: ''Z * ''Z
  25471.   operand:         abstract wrapped_ref * abstract wrapped_ref
  25472.   in expression:
  25473.     = (wrapped_abstract_ref,wrapped_abstract_ref)
  25474.  
  25475. - datatype 'a type_only = TypeOnly;
  25476. datatype 'a  type_only
  25477. con TypeOnly : 'a type_only
  25478. - fun equal (x as TypeOnly, y as TypeOnly) = x = y;
  25479. val equal = fn : ''a type_only * ''a type_only -> bool
  25480. - (*             ^--- doesn't really have to be an equality type *)
  25481. Status: not a bug (language problem)
  25482. ----------------------------------------------------------------------
  25483. 536. twig out of date
  25484. Submitter: wgehrke@risc.uni-linz.ac.at (Wolfgang Gehrke)
  25485. Date: 3/26/92
  25486. Version: 0.75
  25487. Problem: 
  25488.   I had a small trouble to use twig together with this version of ML.
  25489.   There were two problems:
  25490.  
  25491.   1) The generated code contains identifiers beginning with '_'.
  25492.  
  25493.   2) I also changed "invoke.sml" to get a stand alone version.
  25494. Status: fixed in 0.90
  25495. ----------------------------------------------------------------------
  25496. 537. System.system fails in noshare compiler after Heap extension
  25497. Submitter: Eric Madelaine <Eric.Madelaine@sophia.inria.fr>
  25498. Date: 3/26/92
  25499. Version: 0.75
  25500. System: sparc
  25501. Severity: major
  25502. Problem: 
  25503.   When using an sml "-noshare" system, 
  25504.   and after the first "Heap extension",
  25505.   any call to System.system fails with:
  25506.  
  25507.       uncaught exception SystemCall
  25508.  
  25509.   This error does not occur before having the heap extended, nor in
  25510.   a system built without the "-noshare" option, even after many heap
  25511.   extensions.
  25512.   [followup on 3/31/92]:
  25513.   It occurs now in any configuration of my system (may be because it is
  25514.   bigger now).
  25515. Status: fixed in 0.84
  25516. ----------------------------------------------------------------------
  25517. 538. uncaught exception subscript during compilation
  25518. Submitter: Dave MacQueen
  25519. Date: 3/30/92
  25520. Version: 0.78
  25521. Problem: 
  25522. Code: 
  25523. (* hacked version of code from David Ladd *)
  25524. (* Variables provide a more sophisticated and better packaged version
  25525. of ID's *)
  25526.  
  25527. signature VARIABLES =
  25528. sig
  25529.   datatype var  (* variables *)
  25530.    = PREVBL of string
  25531.    | VBL of {name: string, stamp: int}
  25532.   val varname : var -> string
  25533.   (* following are concerned with "alpha conversion" *)
  25534.   type varenv
  25535.   val newvar: string -> var
  25536.   val empty_env : varenv
  25537.   val lookup : varenv * string -> var option
  25538.   val bind : string * var * varenv -> varenv
  25539. end
  25540.  
  25541. structure Variables: VARIABLES =
  25542. struct
  25543. (* Rather than represent variables as simple strings, I introduce
  25544.    a variable type (var).  The first form (PREVBL) is a temporary variable
  25545.    produced on parsing, and then replaced when static analysis is performed
  25546.    to determine scoping and association between binding and applied occurences
  25547.    of variables.  If parsing is made a bit more complicated, this static
  25548.    analysis can be done on the fly during parsing and only the second form
  25549.    of variable would be needed (this is how it is currently done in the ML
  25550.    compiler.  For the VBL form, the stamp field is an integer that uniquely
  25551.    identifies that variable.
  25552. *)
  25553.   datatype var  (* variables *)
  25554.    = PREVBL of string
  25555.    | VBL of {name: string, stamp: int}
  25556.  
  25557.   fun varname(PREVBL s) = s
  25558.     | varname(VBL{name,stamp}) = name ^ "." ^ makestring stamp
  25559.  
  25560.   val count = ref 0
  25561.  
  25562.   fun newvar s = VBL{name=s, stamp=(inc count; !count)}
  25563.  
  25564.   type varenv = (string * var) list
  25565.  
  25566.   val empty_env = []
  25567.  
  25568.   fun lookup([],_) = NONE
  25569.     | lookup((s,v)::rest,s') = if s = s' then SOME v else lookup(rest,s')
  25570.  
  25571.   fun bind(s,v,env) = (s,v)::env
  25572. end (* structure Variables *)
  25573.  
  25574.  
  25575. (* it will probably be more convenient to have a smaller number of
  25576.    cases in the expression datatype.  One way of reducing the number
  25577.    of expression constructs is to have an APP constructor that takes
  25578.    an "operator" and a list of argument expressions.  If the set of
  25579.    possible operators is fixed, then they may be defined as the
  25580.    constructors of an operator datatype, as below.  If new operators
  25581.    can be introduced, then a more complicated operator type would be
  25582.    appropriate.  You might look at src/absyn/bareabsyn.sml to see how
  25583.    the ML abstract syntax is defined.
  25584.  
  25585.    Each operator needs to be assigned its arity, and when constructing
  25586.    an expression, or when checking its "well-formedness" (a mild form
  25587.    of type checking), one would verify that the length of the argument
  25588.    list matches the arity of the operator.
  25589.  
  25590.    For proper type checking, each operator would be assigned a type,
  25591.    which would presumably subsume its arity.
  25592. *)
  25593.  
  25594. structure Operators =
  25595. struct
  25596.   datatype operator
  25597.    = PLUS
  25598.    | MINUS
  25599.    | MUL
  25600.    | DIV
  25601.    | MOD
  25602.    | EXP
  25603.    | SHL
  25604.    | SHR
  25605.    | BAND
  25606.    | BOR
  25607.    | XOR
  25608.    | EQ
  25609.    | NEQ
  25610.    | GT
  25611.    | LT
  25612.    | GTE
  25613.    | LTE
  25614.    | AND
  25615.    | OR
  25616.    | IS_IN
  25617.    | UNION
  25618.    | INTERSECTION
  25619.    | SUBSE
  25620.    | SET_EQ
  25621.    | SET_MINUS
  25622.    | MATCH
  25623.    | NOT_MATCH
  25624.    | UMINUS
  25625.    | NOT
  25626.    | BNOT
  25627.    | COUNT
  25628.    | MIN
  25629.    | MAX
  25630.    | SUM
  25631.  
  25632.   (* following function is useful for printing expressions, as in ppexpr *)
  25633.   fun operName PLUS = "plus"
  25634.     | operName MINUS = "minus"
  25635.     | operName MUL = "mul"
  25636.     | operName DIV = "div"
  25637.     | operName MOD = "mod"
  25638.     | operName EXP = "exp"
  25639.     | operName SHL = "shl"
  25640.     | operName SHR = "shr"
  25641.     | operName BAND = "band"
  25642.     | operName BOR = "bor"
  25643.     | operName XOR = "xor"
  25644.     | operName EQ = "eq"
  25645.     | operName NEQ = "neq"
  25646.     | operName GT = "gt"
  25647.     | operName LT = "lt"
  25648.     | operName GTE = "gte"
  25649.     | operName LTE = "lte"
  25650.     | operName AND = "and"
  25651.     | operName OR = "or"
  25652.     | operName IS_IN = "is_in"
  25653.     | operName UNION = "union"
  25654.     | operName INTERSECTION = "intersection"
  25655.     | operName SUBSE = "subse"
  25656.     | operName SET_EQ = "set_eq"
  25657.     | operName SET_MINUS = "set_minus"
  25658.     | operName MATCH = "match"
  25659.     | operName NOT_MATCH = "not_match"
  25660.     | operName UMINUS = "uminus"
  25661.     | operName NOT = "not"
  25662.     | operName BNOT = "bnot"
  25663.     | operName COUNT = "count"
  25664.     | operName MIN = "min"
  25665.     | operName MAX = "max"
  25666.     | operName SUM = "sum"
  25667.  
  25668.   fun arity(oper: operator) : int =
  25669.       case oper
  25670.     of UMINUS => 1
  25671.      | NOT => 1
  25672.      | BNOT => 1
  25673.      | COUNT => 1
  25674.      | MIN => 1
  25675.      | MAX => 1
  25676.      | SUM => 1
  25677.      | _ => 2
  25678.  
  25679. end (* structure Operators *)
  25680.  
  25681. open Variables Operators
  25682.  
  25683. (* the rest of this should be packaged in structures too, but its getting
  25684.    late so I'm not going to finish it. *)
  25685.  
  25686. datatype exp
  25687.  = INT of int          (* was CONST *)
  25688.  | STR of string
  25689.  | ENUM of string    (* probably want something more specialized than string *)
  25690.  | VAR of var          (* was ID *)
  25691.  | QUES of exp * exp * exp
  25692.  | SET of exp list
  25693.  | APP of operator * exp list
  25694.  
  25695. (* val test = PLUS(CONST(4),CONST(3)); *)
  25696. val test = APP(PLUS,[INT 4, INT 3])
  25697.  
  25698. datatype stmt
  25699.  = ASSERT of exp
  25700.  | FOR of var * exp * stmt
  25701.  | CMPD of stmt list;
  25702.  
  25703. val testprog = FOR(PREVBL "x",SET([INT(1),INT(2)]),
  25704.         ASSERT(APP(EQ,[VAR(PREVBL "x"),INT 0])));
  25705.  
  25706. val testprog2 = FOR(PREVBL "x",
  25707.             SET([INT 1, INT 2]),
  25708.             CMPD([
  25709.               ASSERT(APP(EQ,[VAR(PREVBL "x"),INT 0])),
  25710.               FOR(PREVBL "x",
  25711.                   SET([INT(3),INT(4)]),
  25712.                   ASSERT(APP(NEQ,[VAR(PREVBL "x"),INT 1]))
  25713.                   ),
  25714.               ASSERT(APP(NEQ,[VAR(PREVBL "x"),INT 1]))
  25715.               ])
  25716.             );
  25717.  
  25718. (* for some useful printing utilities, you might look at 
  25719.    src/basics/printutil.sml in the ML source code.  But much more
  25720.    sophisticated pretty-printing support is likely to become available soon.
  25721. *)
  25722.  
  25723. (* all this concatenating of strings (in a quadratic fashion), is liable
  25724.    to get expensive if you start printing big objects.  It is probably
  25725.    more efficient to print directly rather than build a string.  There
  25726.    will be an sprintf-style facility in the new library we are building,
  25727.    so you could print "into" a string in a linear fashion.
  25728. *)
  25729.  
  25730. (* in src/absyn/printabsyn.sml you can find our rather crude 
  25731.    pretty printer for ML abstract syntax.  It attempts to cope
  25732.    with infix operators and their precedences and other complications.
  25733. *)
  25734.  
  25735. fun prvar (PREVBL s) = s
  25736.   | prvar (VBL{name,stamp}) = name ^ "." ^ makestring stamp
  25737.  
  25738. fun ppexpr (APP(EQ,[a,b])) = ppexpr a ^" == "^ ppexpr b
  25739.   | ppexpr (APP(NEQ,[a,b])) = ppexpr a ^" != "^ ppexpr b
  25740.   | ppexpr (INT i) = makestring i
  25741.   | ppexpr (STR s) = "\"" ^ s ^ "\""
  25742.   | ppexpr (VAR v) = prvar v
  25743.   | ppexpr (SET l) = "{" ^ pplist l ^ "}"
  25744.   | ppexpr (QUES(e1,e2,e3)) =
  25745.      "if " ^ ppexpr e1 ^ " then " ^ ppexpr e2 ^ " else " ^ ppexpr e3
  25746.   | ppexpr (APP(oper,args)) =
  25747.      operName oper ^ "(" ^ pplist args ^ ")"
  25748.      (* here you see the advantage of separating out the operators *)
  25749.  
  25750. and pplist ([h]) = ppexpr h   (* shorthand for h::[] *)
  25751.   | pplist (h::t) = ppexpr h ^ "," ^ pplist t 
  25752.   | pplist [] = "" 
  25753.  
  25754. (* this could be made a bit more efficient.  We probably need to provide
  25755.    a primitive to efficiently build such strings.
  25756. fun sp 0 = ""
  25757.   | sp n = " " ^ sp (n - 1);
  25758. Below is a somewhat faster version (especially as n gets larger.
  25759. *)
  25760.  
  25761. fun sp n =
  25762.     let fun collect(0,l) = l
  25763.       | collect(n,l) = collect(n-1," "::l)
  25764.      in implode(collect(n,[]))
  25765.     end
  25766.  
  25767. fun ppstmt (t,ASSERT(x)) = "\n" ^ sp t ^ ppexpr x ^ ";"
  25768.   | ppstmt (t,FOR(a,b,c)) = 
  25769.       "\n"^ sp t ^"for " ^ (varname a) ^ " in " ^ ppexpr b ^ ppstmt(t+1,c)
  25770.   | ppstmt (t,CMPD(nil)) = ""
  25771.   | ppstmt (tab,CMPD(l)) = 
  25772.     let fun pplist (h::t) = ppstmt(tab,h) ^ pplist t
  25773.       | pplist [] = "" 
  25774.     in 
  25775.     " begin" ^ pplist l ^ "\n" ^ sp (tab - 1) ^ "end"
  25776.     end;
  25777.     
  25778. fun prt (ex) = output(std_out,ppstmt(0,ex) ^ "\n");
  25779.  
  25780.  
  25781. (* to complete this evaluator sensibly you need a more general notion of
  25782.    the values that your expressions can evaluate to.  Presumably you
  25783.    need to deal with strings, booleans, and set values in addition
  25784.    to integers.  The value type will probably be a datatype. *)
  25785.  
  25786. datatype value
  25787.  = INTval of int
  25788.  | STRval of string
  25789.  | BOOLval of bool
  25790.  | SETval of value list  (* allows heterogeneous sets, which probably
  25791.                 don't occur. *)
  25792.  
  25793. fun seval (INT x) = INTval x
  25794.   | seval (APP(PLUS,[a,b])) =
  25795.      let val INTval va = seval a and INTval vb = seval b
  25796.       in INTval(va+vb)
  25797.      end
  25798.   | seval (APP(MINUS,[a,b])) =
  25799.      let val INTval va = seval a and INTval vb = seval b
  25800.       in INTval(va-vb)
  25801.      end
  25802.   | seval (QUES(x,y,z)) = 
  25803.      let val INTval vx = seval x and INTval vy = seval y and INTval vz = seval z
  25804.       in INTval(if vx <> 0 then vy else vz)
  25805.      end
  25806.   | seval (_) = INTval 0; (* ??? *)
  25807.     
  25808. (* what types of values does an operator like EQ apply to?  If it is
  25809. overloaded, and can apply to, say, integers and strings, then the
  25810. evaluation rule has to do a case analysis:
  25811.  
  25812.   | seval (APP(EQ,[a,b])) =
  25813.     case seval a
  25814.       of INTval va =>
  25815.       (case seval b
  25816.          of INTval vb => BOOLval(va = vb)
  25817.           | _ => raise TypeError)
  25818.        | STRval va =>
  25819.       (case seval b
  25820.          of STRval vb => BOOLval(va = vb)
  25821.           | _ => raise TypeError)
  25822.        | ...
  25823. *)
  25824.  
  25825.  
  25826. fun eaconv env (e as VAR(PREVBL x)) = 
  25827.      (case lookup(env,x)
  25828.        of SOME v => VAR v
  25829.         | NONE => e)
  25830.   | eaconv env (APP(oper,args)) = APP(oper, map (eaconv env) args)
  25831.   | eaconv env (QUES(e1,e2,e3)) = QUES(eaconv env e1, eaconv env e2, eaconv env e3)
  25832.   | eaconv env (SET elems) = SET(map (eaconv env) elems)
  25833.   | eaconv env e = e
  25834.     
  25835. fun alphasub (env,ASSERT(x)) = ASSERT(eaconv env x)
  25836.   | alphasub (env,CMPD(l)) =
  25837.       let fun mapped(x) = alphasub(env,x)
  25838.        in CMPD(map mapped l)
  25839.       end
  25840.   | alphasub (env,FOR(PREVBL a, b, c)) = 
  25841.       let val new = newvar a
  25842.        in FOR(new, (eaconv env b), alphasub( bind(a,new,env), c))
  25843.       end
  25844.   | alphasub (env,stmt) = stmt;
  25845.  
  25846. fun aconv(x) = alphasub(empty_env,x);
  25847.  
  25848. Status: fixed in 0.83
  25849. ----------------------------------------------------------------------
  25850. 539. weak typing bug
  25851. Submitter: John Greiner
  25852. Date: 4/2/92
  25853. Version: 0.75
  25854. Severity: major
  25855. Problem: 
  25856.   weak typing failure
  25857. Transcript: 
  25858. - (let val x = ref nil in fn y => x end) ();
  25859. val it = ref [] : '1a list ref
  25860.  
  25861. - let val a = (let val x = ref nil in fn y => x end) () in
  25862. = a:=[1]; hd(!a)^"hi" end;
  25863. val it = "\^Ahi" : string
  25864.  
  25865. In V.73 (I think) this wasn't there, as I have referenced in a file:
  25866. - (let val x = ref nil in fn y => x end) ();
  25867. std_in:2.1-2.41 Error: nongeneric weak type variable
  25868.   it : '~1Z list ref
  25869.  
  25870. Status: fixed in 0.89
  25871. ----------------------------------------------------------------------
  25872. 540. printing hanging on Mach
  25873. Submitter: Bob Harper
  25874. Date: 4/2/92
  25875. Version: 0.78
  25876. System: DecStation 5000, Mach, running over telnet
  25877. Severity: major
  25878. Problem: 
  25879.   Type "structure S = System".
  25880.   On my machine it prints about halfway through, then hangs.
  25881. Comment:
  25882.   Sometimes when running sml over a telnet, the printing hangs.  You can
  25883.   continue by typing space.  This is not new to 0.78. [Gene Rollins]
  25884.  
  25885.   [Bob Harper, 4/11/92]:
  25886.   Incidentally, on the PMAX (at least) I consistently get the following
  25887.   behavior.  I type in something, particularly something that incurs a type
  25888.   error.  I get back half or three quarters of a message, then it hangs.  The
  25889.   only way out is to type ^C, which gets me back to the prompt.  If I type the
  25890.   same thing again, I may or may not get the full message.  Often I just kill
  25891.   the session and start over, then it works (for a while).  We're running Mach
  25892.   on the PMAX, and I'm using ML via telnet, within an emacs ML interaction
  25893.   window, if it matters.
  25894. Status: fixed in 0.84
  25895. ----------------------------------------------------------------------
  25896. 541. warnings while compiling runtime
  25897. Submitter:      Kai Kein{nen <kmk@cc.tut.fi>
  25898. Date:        April 5, 1992
  25899. Version:        0.80 from research.att.com:/dist/ml/working on April 5
  25900. System:         RISC/OS 4.52, MIPS RC 6280
  25901. Severity:       minor
  25902. Problem:        compilation time warnings for gc.c and prim.s
  25903. Code:           ./makeml -mips riscos
  25904. Transcript:     
  25905.  
  25906. ./makeml> (cd runtime; make clean)
  25907.     rm -f *.o lint.out prim.s linkdata allmo.s run
  25908. ./makeml> rm -f mo
  25909. ./makeml> ln -s ../mo.mipsb mo
  25910. ./makeml> (cd runtime; rm -f run allmo.o allmo.s)
  25911. ./makeml> (cd runtime; make MACHINE=MIPS  'CFL= -systype bsd43' 'LIBS=' 'DEFS= -DRISCos -DRUNTIME=\"runtime\"' linkdata)
  25912.     cc -O -systype bsd43 -DMIPS -DRISCos -DRUNTIME=\"runtime\" -o linkdata linkdata.c
  25913. ./makeml> runtime/linkdata [runtime/IntMipsBig.mos]
  25914. runtime/linkdata> as runtime/allmo.s -o runtime/allmo.o
  25915. ./makeml> (cd runtime; make  MACHINE=MIPS 'DEFS= -DRISCos' 'CPP=/lib/cpp -P' 'CFL= -systype bsd43' 'AS=as' 'LIBS=')
  25916.     cc -O -systype bsd43 -DMIPS -DRISCos -c run.c
  25917.     cc -O -systype bsd43 -DMIPS -DRISCos -c run_ml.c
  25918.     cc -O -systype bsd43 -DMIPS -DRISCos -c callgc.c
  25919.     cc -O -systype bsd43 -DMIPS -DRISCos -c gc.c
  25920.  
  25921. uopt: Warning: gc: this procedure not optimized because it
  25922.       exceeds size threshold; to optimize this procedure, use -Olimit option
  25923.       with value >=  886.
  25924.     cc -O -systype bsd43 -DMIPS -DRISCos -c MIPS.dep.c
  25925.     cc -O -systype bsd43 -DMIPS -DRISCos -c export.c
  25926.     cc -O -systype bsd43 -DMIPS -DRISCos -c timers.c
  25927.     cc -O -systype bsd43 -DMIPS -DRISCos -c ml_objects.c
  25928.     cc -O -systype bsd43 -DMIPS -DRISCos -c cfuns.c
  25929.     cc -O -systype bsd43 -DMIPS -DRISCos -c cstruct.c
  25930.     cc -O -systype bsd43 -DMIPS -DRISCos -c signal.c
  25931.     cc -O -systype bsd43 -DMIPS -DRISCos -c exncode.c
  25932.     cc -O -systype bsd43 -DMIPS -DRISCos -c malloc.c
  25933.     cc -O -systype bsd43 -DMIPS -DRISCos -c mp.c
  25934.     cc -O -systype bsd43 -DMIPS -DRISCos -c sync.c
  25935.     /lib/cpp -P -DASM -DMIPS -DRISCos MIPS.prim.s > prim.s
  25936.     as -o prim.o prim.s
  25937. as0: Warning: prim.s, line 305: missing .end preceding this .ent: set_request
  25938.       .ent set_request
  25939. as0: Warning: prim.s, line 305: .ent/.end block never defined the procedure name
  25940. as0: Warning: prim.s, line 434: missing .end preceding this .ent: go
  25941.       .ent go
  25942.  
  25943. Comments:
  25944. Some of the corrections needed earlier for MIPS R6000 seem to be
  25945. missing from this version.
  25946. The interpreter seems to work correctly in spite of these warnings.
  25947.  
  25948. Status: fixed in 0.90
  25949. ----------------------------------------------------------------------
  25950. 542. lack of environment cleanup in 0.80
  25951. Submitter: schristensen@daimi.aau.dk (Soren Christensen)
  25952. Date: 4/6/92
  25953. Version: 0.80
  25954. Severity: major
  25955. Problem: 
  25956.   The other question is related to a problem I had in 0.75:
  25957.   >fun x 0 = () | x n = (use_stream (open_string "3"); x (n-1));
  25958.   >fun test () = (exportML "pre"; x 1000; exportML "post");
  25959.   >
  25960.   >Try test(); and check the diff in size of pre and post.
  25961.  
  25962.   There seems to be a more grneral problem in 0.80. The toplevel environment
  25963.   seems to grow - even if I do not declare new names. Now that I can inspect
  25964.   the valuse in the environmet I find "VAL$it" repeted.
  25965.   try:
  25966.    map (fn x => print (System.Symbol.makestring x))(System.Env.catalogEnv
  25967.   (System.Env.staticPart (!System.Env.topLevelEnvRef)));
  25968.  
  25969.   Especially after running for a while.
  25970. Status: fixed in 0.82
  25971. ----------------------------------------------------------------------
  25972. 543. top-level printing fails
  25973. Submitter: Bob Harper
  25974. Date: 4/8/92
  25975. Version: ?
  25976. Severity: major
  25977. Problem: 
  25978. Code: 
  25979.     type OrdId = string
  25980.     type ModId = string
  25981.  
  25982.     datatype Ord =
  25983.     Kind
  25984.       | Type
  25985.       | Pi of Dec * Ord
  25986.       | Abs of Dec * Ord
  25987.       | App of Ord * Ord
  25988.       | Cast of Ord * Ord
  25989.       | One
  25990.       | Sub of Ord * Sub
  25991.       | Fst of Mod
  25992.  
  25993.     and Mod =
  25994.         KindM
  25995.       | Signature
  25996.       | PiM of DecM * Mod
  25997.       | AbsM of DecM * Mod
  25998.       | AppM of Mod * Mod
  25999.       | OneM
  26000.       | CastM of Mod * Mod
  26001.       | SubM of Mod * Sub
  26002.       | Nil
  26003.       | NilSig
  26004.       | OTuple of Def * Mod
  26005.       | OTupleSig of Dec * Mod
  26006.       | RTuple of DefM * Mod
  26007.       | RTupleSig of DecM * Mod
  26008.       | FstM of Mod
  26009.       | SndM of Mod
  26010.  
  26011.     and Sub =
  26012.     Id
  26013.       | Shift
  26014.       | ODef of Sub * (OrdId * Ord * Ord option)
  26015.       | MDef of Sub * (ModId * Mod * Mod option)
  26016.       | Comp of Sub * Sub
  26017.  
  26018.     and Ctx =
  26019.     Null
  26020.       | ODec of Ctx * Dec
  26021.       | MDec of Ctx * DecM
  26022.  
  26023.     and Dec = Dec of OrdId * Ord
  26024.     and Def = Def of OrdId * Ord
  26025.  
  26026.     and DecM = DecM of ModId * Mod
  26027.     and DefM = DefM of ModId * Mod ;
  26028. Transcript: 
  26029.   I type:
  26030.  
  26031.   val S = OTupleSig(Dec("t",Type),NilSIg);
  26032.  
  26033.   I get:
  26034.  
  26035.   val S = OTupleSig (
  26036.   uncaught exception Subscript
  26037.  
  26038.   The actual input is much larger: I build the system using SourceGroup, then
  26039.   open the structure IntSyn, which makes available this datatype, which then
  26040.   results in the exhibited behavior.
  26041. Status: fixed in 0.84
  26042. ----------------------------------------------------------------------
  26043. 544. poor error message
  26044. Submitter: John Reppy
  26045. Date: 4/16/92
  26046. Version: 0.81
  26047. Severity: minor
  26048. Problem: 
  26049.   The error message
  26050.  
  26051.     Error: non-constructor applied to argument in pattern
  26052.  
  26053.   would be much more useful if it gave the name of the  identifier.
  26054. Comment: [dbm, 10/7/92]
  26055.   There are two places where this message was generated.  In elabutil.sml
  26056.   code has been added to print the bogus rator.  In astutil.sml the message
  26057.   has been changed to "nonidentifier applied to argument in pattern",
  26058.   but bogus pattern is not printed because there is no ast printer yet.
  26059. Status: open (patially fixed in 0.91)
  26060. ----------------------------------------------------------------------
  26061. 545. signature matching looping?
  26062. Submitter:     Amy Moormann Zaremski <amy+@cs.cmu.edu>
  26063. Date:        Mar 5, 1992
  26064. Version:    .75 (both with and without sourcegroup)
  26065. System:        Dec 3100, Mach ??(whatever default is right now) 
  26066. Severity:    minor
  26067. Problem:    Certain signature/structure combinations cause
  26068.         SML to "loop" (grow the heap until memory is
  26069.         exhausted).
  26070. Code:
  26071.         signature S = sig
  26072.           val f : 'b -> int
  26073.         end
  26074.  
  26075.         structure S1:S = struct
  26076.           fun f x = x
  26077.         end
  26078.  
  26079. Transcript:
  26080. Standard ML of New Jersey, Version 75, November 11, 1991
  26081. Arrays have changed; see Release Notes
  26082. val it = () : unit
  26083. - signature S = sig
  26084. =   val f : 'b -> int
  26085. = end;
  26086. signature S = 
  26087.   sig
  26088.     val f : 'a -> int
  26089.   end
  26090. - structure S1:S = struct
  26091. =   fun f x = x
  26092. = end;
  26093.  
  26094. [Major collection...
  26095. [Increasing heap to 2478k]
  26096.  
  26097. [Increasing heap to 4798k]
  26098.  92% used (1550460/1673392), 1188 msec]
  26099.  
  26100. [Increasing heap to 7002k]
  26101.  
  26102. [Major collection... 74% used (2960732/3949436), 2797 msec]
  26103.  
  26104. [Increasing heap to 11582k]
  26105.  
  26106. [Major collection...
  26107. [Increasing heap to 17730k]
  26108.  80% used (5808988/7231036), 5062 msec]
  26109.  
  26110. [Increasing heap to 21198k]
  26111.  
  26112. [Major collection...
  26113. [Increasing heap to 32438k]
  26114.  80% used (10635356/13238652), 9407 msec]
  26115.  
  26116. [Increasing heap to 32634k]
  26117.  
  26118. [Major collection... 73% used (13238652/17984796), 12468 msec]
  26119.  
  26120. [Increasing heap to 32710k]
  26121.  
  26122. [Major collection...
  26123. [Increasing heap to 32734k]
  26124.  
  26125. [Increasing heap to 32746k]
  26126.  
  26127. [Increasing heap to 32750k]
  26128.  
  26129. [Increasing heap to 32754k]
  26130.  
  26131. Warning: can't increase heap
  26132.  
  26133. Ran out of memory
  26134. Process Inferior smlsg exited abnormally with code 3
  26135. Status: fixed in 0.83
  26136. ----------------------------------------------------------------------
  26137. 546. System.architecture not initialized
  26138. Submitter: Gene Rollins, Dave MacQueen
  26139. Date: 4/24/92
  26140. Version: 0.81
  26141. Severity: minor
  26142. Problem: 
  26143.   System.architecture not initialized because comment brackets
  26144.   in cps/shareglue.sml haven't been removed.
  26145. Status: fixed in 0.81
  26146. ----------------------------------------------------------------------
  26147. 547. interrupt not working (inside emacs)
  26148. Submitter:      slind@research.att.com
  26149. Date:           April 27, 1992
  26150. Version:        81
  26151. System:         mips (It doesn't occur on the sun4)
  26152. Severity:       major
  26153. Problem:     1) In gnu emacs, sml goes into an infinite loop when I hit the 
  26154.                 interrupt key, i.e., on the DEL character. Then sml seems to
  26155.                 ignore signals: the only way to regain control is to kill the
  26156.                 sml process. Merely exiting emacs will not kill the sml 
  26157.                 process.
  26158.  
  26159.              2) A related problem is that interrupt doesn't give the right
  26160.                 exception (and not until a carriage return): it returns the
  26161.                 Abort exception.
  26162.                 
  26163. Transcript:     
  26164.  
  26165. 1) (Inside gmacs.)
  26166.  
  26167.     $ sml
  26168.     Standard ML of New Jersey, Version 0.81, 9 April 1992
  26169.     Arrays have changed; see Release Notes
  26170.     val it = () : unit
  26171.     -
  26172.     \003
  26173.     \003
  26174.     \004
  26175.  
  26176.  
  26177. 2) (In the shell)
  26178.  
  26179.     $ sml
  26180.     Standard ML of New Jersey, Version 0.81, 9 April 1992
  26181.     Arrays have changed; see Release Notes
  26182.     val it = () : unit
  26183.     - <DEL key struck: nothing happens; now issue a CR>
  26184.     std_in:3.1 Error: illegal token
  26185.  
  26186.     uncaught exception Abort
  26187.     -
  26188. Status: fixed in 0.82 (same as 550)
  26189. ----------------------------------------------------------------------
  26190. 548. blast_read on ints
  26191. Submitter:      slind@research.att.com
  26192. Date:           April 28, 1992
  26193. Version:        75, 81
  26194. System:         mips and sparc at least; probably all
  26195. Severity:       minor
  26196. Problem:        System.Unsafe.blast_X (where X probably = "read", but I'm not
  26197.                 sure). Solitary ints aren't handled properly: in 81, core gets
  26198.                 dumped; in 75, the wrong value is returned.
  26199. Transcript:     
  26200.  
  26201. In 81:
  26202.        $ sml
  26203.        Standard ML of New Jersey, Version 0.81, 9 April 1992
  26204.        Arrays have changed; see Release Notes
  26205.        val it = () : unit
  26206.        - val outs = open_out "foo";
  26207.        val outs = - : outstream
  26208.        - System.Unsafe.blast_write(outs,1);
  26209.  
  26210.        [Major collection...abandoned]
  26211.        val it = () : unit
  26212.        - close_out outs;
  26213.        val it = () : unit
  26214.        - val ins = open_in "foo";
  26215.        val ins = - : instream
  26216.        - System.Unsafe.blast_read ins : int;
  26217.        Memory fault - core dumped
  26218.        $ 
  26219.  
  26220.  
  26221. In 75:
  26222.  
  26223.        -  val outs = open_out "foo";
  26224.        val outs = - :outstream
  26225.        - System.Unsafe.blast_write(outs,1);
  26226.        [Major collection...abandoned]
  26227.        val it = () :unit
  26228.        - close_out outs;
  26229.        val it = () :unit
  26230.        - val ins = open_in "foo";
  26231.        val ins = - :instream
  26232.        - System.Unsafe.blast_read ins : int;
  26233.        val it = 3242475 :int
  26234.        -
  26235. Status: fixed in 0.86
  26236. ----------------------------------------------------------------------
  26237. 549. Match exception while compiling
  26238. Submitter:      jont@uk.co.harlqn
  26239. Date:        28/04/92
  26240. Version:        SML of NJ version 0.75
  26241. System:         Sun 4/330 with SunOS 4.1.1
  26242. Severity:       minor
  26243. Transcript:
  26244. - val _ = =;
  26245. std_in:1.9 Error: nonfix identifier required
  26246.  
  26247. uncaught exception Match
  26248.  
  26249. Comment: I guess this shouldn't happen. It's not the sort of
  26250. thing I type regularly, I was prompted to do it by the compiler's
  26251. habit of inserting = all over the place when it thinks I've left out
  26252. an identifier.
  26253. Comment: in 0.89 produces following
  26254. - val _ = = ;
  26255. std_in:0.0 Error: nonfix identifier required
  26256. Error: Compiler bug: elabVB
  26257. -
  26258. Status: fixed in 0.91 (dbm)
  26259. ----------------------------------------------------------------------
  26260. 550. interrupt on MIPS
  26261. Submitter: Lal George
  26262. Date: 4/29/92
  26263. Version: 0.81
  26264. System: MIPS/Riscos 4.52
  26265. Severity: major
  26266. Problem: 
  26267. 0.81 on the MIPS has problems with signal handling. 
  26268. An interrupt (ctrl-c) causes it to go into deep space, 
  26269. eating up cpu time.
  26270. Status: fixed in 0.82
  26271. ----------------------------------------------------------------------
  26272. 551. large integers yield Illegal instruction
  26273. Submitter: Kjeld H. Mortensen | Email: kjeld@metasoft.com
  26274. Date: 4/29/92
  26275. Version: 0.81
  26276. System: ?
  26277. Severity: major
  26278. Problem: 
  26279.   Large integer literal causes illegal instruction.
  26280. Transcript: 
  26281.   metasparc 141 : /d1/tools/njsml/81/sml.sparc.ns
  26282.   Standard ML of New Jersey, Version 0.81, 9 April 1992
  26283.   Arrays have changed; see Release Notes
  26284.   val it = () : unit
  26285.   - 536870911;
  26286.   val it = 536870911 : int
  26287.   - 536870912;
  26288.   Illegal instruction
  26289.   metasparc 142 :
  26290. Comments:
  26291.   536870912 seems to be 2^29. (Similar behaviour, of course, for 
  26292.   corresponding negative numbers.)
  26293.  
  26294.   This compiler was build with 'makeml -noshare' on a Sun4, but
  26295.   compilers build with 'makeml' have same behaviour.
  26296.  
  26297.   In SML/NJ v0.80 this is no problem. Here integers can be 
  26298.   up to (2^30)-1 and it doesn't give 'Illegal instruction'.
  26299. Status: Fixed in 0.81 (?)
  26300. ----------------------------------------------------------------------
  26301. 552. Error message line numbers from std_in (see also 575)
  26302. Submitter:      Lal George
  26303. Date:        30th April, '92
  26304. Version:        0.81
  26305. System:         all
  26306. Severity:       major
  26307. Problem:        Error line numbers are incorrect in the interactive session.
  26308. Transcript:     
  26309.  
  26310.     Standard ML of New Jersey, Version 0.81, 9 April 1992
  26311.     Arrays have changed; see Release Notes
  26312.     val it = () : unit
  26313.     - val x = 1;
  26314.     val x = 1 : int
  26315.     - fun f x = val y = 2 in x + y end;
  26316. -->    std_in:4.11 Error: syntax error found at VAL
  26317.     - val x = 3;
  26318.     val x = 3 : int
  26319.     - val x = 4;
  26320.     val x = 4 : int
  26321.     -  fun f x = val y = 2 in x + y end;
  26322. -->    std_in:6.12 Error: syntax error found at VAL
  26323.  
  26324. Comments:
  26325.     This is a nuisance for programs that do regression testing,
  26326. or under emacs ML-mode.
  26327. Status: fixed in 0.91
  26328. ----------------------------------------------------------------------
  26329. 553. incorrect syntax accepted
  26330. Submitter: John Reppy
  26331. Date: 4/30/92
  26332. Version: 0.81a
  26333. Severity: minor
  26334. Problem: 
  26335.   The following things are not legal SML syntax, but we accept them:
  26336. Transcript: 
  26337.   Standard ML of New Jersey, Version 0.81, 9 April 1992
  26338.   Arrays have changed; see Release Notes
  26339.   val it = () : unit
  26340.   - let in 1 end;
  26341.   val it = 1 : int
  26342.   - let ; in 1 end;
  26343.   val it = 1 : int
  26344.   - let ;;; in 1 end;
  26345.   val it = 1 : int
  26346.   - 
  26347. Fix:
  26348.   change "LET ldecs IN " to "LET ldec ldecs IN"
  26349. Note that there are probably two places where this occurs; the other
  26350. is "LET sdecs IN" or something like that.
  26351.   Note: the Definition allows an "empty declaration" so this isn't a bug.
  26352. Status: not a bug
  26353. ----------------------------------------------------------------------
  26354. 554. unused token constructor QUERY
  26355. Submitter: John Reppy
  26356. Date: 4/29/92
  26357. Version: 0.81a
  26358. Severity: trivial
  26359. Problem: 
  26360.   I notice that there is a terminal symbol named QUERY declared in
  26361.   ml.grm, which is never used.
  26362. Fix: remove QUERY constructor
  26363. Status: fixed in 0.90
  26364. ----------------------------------------------------------------------
  26365. 555. window signal
  26366. Submitter:      John Reppy (jhr@research.att.com)
  26367. Date:           May 8, 1992
  26368. Version:        versions 75-81 (at least)
  26369. System:         RISCOS (R3000 & R6000)
  26370. Severity:       major
  26371. Problem:        resizing a shell window (xterm or cmdtool) that is running sml
  26372.         causes the sml process to either die or go into an infinite loop.
  26373. Comments:
  26374.   This is likely a problem with the handling of WINCH signals, but it doesn't seem
  26375.   to be related to the general problems with signals on the MIPS in 0.81.
  26376. Status: fixed in 0.82
  26377. ----------------------------------------------------------------------
  26378. 556. large integers on Sparc
  26379. Submitter:      <Sven Doerr, Univ. Karlsruhe, Germany; sd@ira.uka.de>
  26380. Date:        <Tue May 12 14:43:25 MET DST 1992>
  26381. Version:        <SML of NJ version number, 0.81>
  26382. System:         <sun4, SunOS Release 4.1.1>
  26383. Severity:       <minor>
  26384. Problem:        <typing large integers at top level or arithmetic overflow
  26385.          aborts sml with: Illegal instruction>
  26386. Code:           < 0x80000000 <return> >
  26387. Transcript:     <
  26388.         Standard ML of New Jersey, Version 0.81, 9 April 1992
  26389.         Arrays have changed; see Release Notes
  26390.         val it = () : unit
  26391.         - 100000 * 100000;
  26392.         Illegal instruction
  26393.         >
  26394. Status: fixed in 0.83
  26395. ----------------------------------------------------------------------
  26396. 557. sparc signals
  26397. Submitter:      Andre Kramer akramer@ecrc.de
  26398. Date:           Thu May 14 
  26399. Version:        0.75 
  26400. System:         sparc
  26401. Severity:       <minor, major, or critical>
  26402. Problem:        asynchronous exceptions for sparc
  26403.  
  26404.        file SPARC.prim.s
  26405.  
  26406.                 _savefpregs  
  26407.                   retl
  26408.                   nop
  26409.        does nothing.
  26410.  
  26411.        in signal.c 
  26412.  
  26413.                  /*
  26414.                * save floating point registers.
  26415.                   */
  26416.                   savefpregs(msp);
  26417.                   fpregs = ((int *)(msp->ml_allocptr)) + 1;
  26418.                   msp->ml_allocptr += (NSAVED_FPREGS*2 + 1) * sizeof(int);
  26419.  
  26420.        allocates 1 word from heap and later saves a pointer to it (fpregs). 
  26421.        this word should contain a descriptor (len 0,tag string): 
  26422. Fix:
  26423.        (MAKE_DESC(NSAVED_FPREGS*8,tag_string)) 
  26424.        as is done in _savefpregs for the M68, MIPS.  
  26425.        (VAX is same as Sparc).
  26426.  
  26427. Comments:
  26428.         I have a another question on the new calling conventions 
  26429.         (CALLEESAVE) for sparc.
  26430.         If register masks in code strings don't contain the 
  26431.         CLOSURE_INDX the last bit is 0. 
  26432.         A mask then either looks like a pointer or an int.
  26433.         Does this not affect the garbage collector?  
  26434. Status: fixed in some version between 0.75 and 0.81
  26435. ----------------------------------------------------------------------
  26436. 558. local...end structure expressions not working in 0.80
  26437. Submitter:      Tim Freeman, tsf@cs.cmu.edu
  26438. Date:        Fri May 15 14:38:42 1992
  26439. Version:        0.80
  26440. System:         Sun 4 running Mach
  26441. Severity:       minor
  26442. Problem:        The new compiler doesn't know that local...end is
  26443.             sensible at the structure level.
  26444. Transcript:     val it = () : unit
  26445.         - System.Compile.makeSource ("foo",1,std_in,true,std_out);
  26446.         val it = prim? : source
  26447.         - val staticEmpty = System.Env.staticPart (System.Env.emptyEnv ());
  26448.         val staticEmpty = prim? : staticEnv
  26449.         - val s = System.Compile.makeSource ("foo",1,std_in,true,std_out);
  26450.         val s = prim? : source
  26451.         - System.Compile.compile (s,staticEmpty);
  26452.         - local
  26453.         =    structure x = struct val z = 3 end
  26454.         = in
  26455.         =    structure y = struct val w = x.z end
  26456.                 = end;
  26457.         uncaught exception Compile
  26458. Status: fixed in 0.84
  26459. ----------------------------------------------------------------------
  26460. 559. static environment not cleaned up
  26461. Submitter: Dave MacQueen
  26462. Date: 5/17/92
  26463. Version: 0.81
  26464. Severity: average
  26465. Problem: 
  26466.   Top level static environment is not consolidated in the interactive
  26467.   loop, so hidden static bindings are not removed and static environment
  26468.   grows too fast.
  26469. Fix:
  26470.   Add a call of Environment.consolidate when newenv is built at the
  26471.   end of function evalLoop in functor Interact (build/interact.sml).
  26472. Status: fixed in 0.84
  26473. ----------------------------------------------------------------------
  26474. 560. blast functions and separate compilation
  26475. Submitter:      Emden R. Gansner, erg@ulysses.att.com
  26476. Date:           18 May 1992
  26477. Version:        0.81c
  26478. System:         Sparc 2, SunOS 4.1
  26479. Severity:       major
  26480. Problem:        Separate compilation facility is broken
  26481. Code:           
  26482.   structure SepComp =
  26483.     struct
  26484.   
  26485.     val fname = "a.o"
  26486.   
  26487.     fun compFile () = let
  26488.       open System.Compile System.Env
  26489.       val targetWrite : (outstream * compUnit) -> unit = System.Unsafe.blast_write
  26490.       val staticPerv = staticPart(!pervasiveEnvRef)
  26491.       val sourceF = open_string "structure A = struct end"
  26492.       val source = makeSource("", 1, sourceF, false, std_out)
  26493.       val compUnit as (static, code) =
  26494.               (compile(source,staticPerv)) 
  26495.                  handle e => (closeSource source; raise e)
  26496.       val outstr = open_out fname
  26497.       in
  26498.         targetWrite (outstr, compUnit);
  26499.         closeSource source;
  26500.         close_out outstr
  26501.       end
  26502.   
  26503.     fun loadFile () = let
  26504.       open System.Compile
  26505.       val targetRead : instream -> compUnit = System.Unsafe.blast_read
  26506.       val instr = open_in fname
  26507.       val effectiveEnv = !System.Env.pervasiveEnvRef
  26508.       val _ = print "starting load \n"
  26509.       val (staticUnit,codeUnit) = targetRead instr
  26510.       in
  26511.         print "readUnit done \n";
  26512.         close_in instr;
  26513.         print "starting execute \n";
  26514.         execute((changeLvars staticUnit,codeUnit), effectiveEnv);
  26515.         print "finished execute \n"
  26516.       end
  26517.     end
  26518.   
  26519.   val _ = SepComp.compFile ()
  26520.   val _ = SepComp.loadFile ()
  26521.   
  26522. Transcript:     loadFile hangs during execute; sending an interrupt
  26523.                 signal produces a core dump
  26524.  
  26525. Comments:       This program works fine in 0.80. Changes made to
  26526.                 blast_read and blast_write in 0.81 are probably the
  26527.                 root of the problem. The above program also failed
  26528.                 in 0.81b, but hung during blast_read. This was mentioned
  26529.                 to Lal, who, I believe, produced 0.81c as a partial fix.
  26530. Status: fixed in 0.82
  26531. ----------------------------------------------------------------------
  26532. 561. exportFn images too big (same as 489)
  26533. Submitter: Andrew Koenig
  26534. Date: 5/19/92
  26535. Version: 0.75
  26536. System: Sparc
  26537. Severity: minor
  26538. Problem: 
  26539.   For practical reasons, it would be nice to get
  26540.   exportFn to create less bulky executables for small programs.
  26541.   For example, here is a somewhat simplified version of the
  26542.   `echo' command:
  26543.  
  26544.       fun echo [] = print "\n"
  26545.         | echo (h::nil) = print (h^"\n")
  26546.         | echo (h::t) = (print(h ^ " "); echo t)
  26547.  
  26548.       fun main(argv, envp) = echo(tl argv)
  26549.  
  26550.   When I use `exportFn' to make an executable of this, it takes
  26551.   136 kbytes using 0.53 on a 10th Edition machine.  Using 0.75
  26552.   on a Sparcstation, the executable is 471 kbytes.  Even if we
  26553.   allow that Sparc executables are bigger, it is hard to believe
  26554.   that that much baggage is truly necessary.
  26555. [from ark, 12/1/92:]
  26556.   I just built 0.92 and gave it a try.
  26557.   When built with -noshare, the following
  26558.  
  26559.       fun main _ = print "Hello world\n";
  26560.       exportFn ("xxx", main);
  26561.  
  26562.   yields a 946K executable with 860K of loadable data.
  26563.   This is as opposed to 376K/249K with 0.75,
  26564.   which in turn was about twice as big as 0.43.
  26565. [from Lal, 12/16/92]
  26566.   We mercifully had the result of exportFn for the lego theorem
  26567.   prover using version 0.66. So I built a noshare version of sml
  26568.   for the Sparc and rebuilt lego using version 0.92.
  26569.  
  26570.   There is more than a Mbyte increase in the size of the exported 
  26571.   image. Below, Olego is the image under 0.66, and lego is the version
  26572.   under 0.92.
  26573.  
  26574.   Either this is to be expected - which is bad, or there are references
  26575.   that are not being cleared - which is also bad.
  26576.  
  26577.   ----------------------------------------------------------------
  26578.   lutece:$ ls -l
  26579.   total 3104
  26580.   -rwxrwxrwx  1 dbm        999456 Mar 26  1991 Olego*
  26581.   -rwxr-xr-x  1 george    2146336 Dec 16 18:38 lego*
  26582. Status: fixed in 0.93c
  26583. ----------------------------------------------------------------------
  26584. 562. SML hanging under telnet (under Mach) (also #540)
  26585. Submitter:      tsf@cs.cmu.edu
  26586. Date:        Tue May 19 15:14:55 1992
  26587. Version:        0.80
  26588. System:         Pmax, running Mach.  Also Sun 4's running mach, but
  26589.         more rarely.  (I'm referring to the type of the
  26590.         machine running SML, not the type of the machine
  26591.         running telnet.) 
  26592. Severity:       minor
  26593. Problem:        When running under telnet, sml intermittently hangs on output.
  26594. Code:           Anything that produces lots of output will do.
  26595. Transcript:     It's long, so I put it at the end of this message.
  26596.         It's not very informative. 
  26597. Comments:    If I say "sml | cat -u" instead of "sml", things work
  26598.         fine.  If I create a remote xterm and run sml within
  26599.         that, or a remote gnu-emacs and run sml within that,
  26600.         things work fine.  The problem only happens when sml's
  26601.         standard output is a pty controlled by telnet.
  26602.  
  26603.         The type of the machine running sml seems to make
  26604.         more of a difference than the type of the machine at
  26605.         the other end of the telnet connection.
  26606. Fix:        Say "sml | cat -u" instead of "sml" to invoke sml at
  26607.         the other end of a telnet connection.
  26608.  
  26609. Looking at the code for flushbuf in boot/perv.sml, I see that you wait
  26610. for output to become possible before sending the first bytes of
  26611. output, but inside the loop in write_all in runtime/cfuns.c, you don't
  26612. wait for output to become possible after a partial write.  This
  26613. discrepancy is strange, but I don't see how it could give rise to this
  26614. bug.  Do you use nonblocking IO?  Why do you wait for output to become
  26615. possible before starting a write?
  26616.  
  26617. I wouldn't be surprised if telnet is the only device you output to
  26618. that doesn't always write all of the bytes you ask it to.
  26619.  
  26620. Here's the transcript.  The details don't matter much, anything that
  26621. produces this much chatter is very likely to hang.  This works fine
  26622. when run locally or when piped through "cat -u".
  26623.  
  26624. % telnet desert.fox
  26625. Trying 128.2.206.48...
  26626. Connected to DESERT.FOX.CS.CMU.EDU.
  26627. Escape character is '^]'.
  26628. DESERT.FOX.CS.CMU.EDU TCP Telnet service.
  26629.  
  26630. 4.3 BSD UNIX (DESERT.FOX.CS.CMU.EDU) (ttyP0)
  26631.  
  26632. login: tsf
  26633. Password:
  26634. Last login: Thu May 14 13:11:17 from 128.2.222.175 (*Unknown*)
  26635. This login: Tue May 19 14:28:07 from 128.2.222.175 (*Unknown*)
  26636. % sml-sg
  26637. Standard ML of New Jersey, Version 0.80, April 2, 1992
  26638.   with SourceGroup 2.1b built on Fri May  8 10:02:15 EDT 1992
  26639. val it = () : unit
  26640. - use "load.sml";
  26641.  
  26642. [closing /afs/cs/user/tsf/sml/lib/setparams.sml]
  26643. Eof
  26644. val it = () : unit
  26645. /afs/cs/user/tsf/sml/lib/link.sml
  26646. /afs/cs/user/tsf/sml/lib/subst.sig.sml
  26647. /afs/cs/user/tsf/sml/lib/subst.sml
  26648. /afs/cs/user/tsf/sml/lib/util.sig.sml
  26649. /afs/cs/user/tsf/sml/lib/util.sml
  26650. val libg = 1 : ?.group
  26651. val makeload = fn : unit -> unit
  26652. [closing /afs/cs/user/tsf/sml/lib/lib.sml]
  26653. Eof
  26654. val it = () : unit
  26655. refine.lex.sml
  26656. refine.grm.sig
  26657. refine.grm.sml
  26658. unify.sml
  26659. unify.sig.sml
  26660. term.sml
  26661. term.sig.sml
  26662. subtypedata.sml
  26663. subtypedata.sig.sml
  26664. subtype.sml
  26665. subtype.sig.sml
  26666. parse.sml
  26667. parse.sig.sml
  26668. mltype.sml
  26669. mltype.sig.sml
  26670. link.sml
  26671. interface.sml
  26672. interface.sig.sml
  26673. interactive.sml
  26674. base.sml
  26675. absyn.sml
  26676. absyn.sig.sml
  26677. refine.lex
  26678. refine.grm
  26679. val newg = 3 : ?.group
  26680. val loadref = fn : unit -> unit
  26681. [reading /afs/cs/user/tsf/sml/lib/.@sys/util.sig.sml.bin]
  26682. signature UTIL
  26683. [reading /afs/cs/user/tsf/sml/lib/.@sys/util.sml.bin]
  26684. functor Util
  26685. [reading /afs/cs/user/tsf/sml/lib/.@sys/subst.sig.sml.bin]
  26686. signature SUBST
  26687. [reading /afs/cs/user/tsf/sml/lib/.@sys/subst.sml.bin]
  26688. functor Subst
  26689. [reading /afs/cs.cmu.edu/project/ergo-tsf/sml/thesis/.@sys/term.sig.sml.bin]
  26690. signature TERM
  26691. [reading /afs/cs.cmu.edu/project/ergo-tsf/sml/thesis/.@sys/unify.sig.sml.bin]
  26692. signature UNIFY
  26693. [reading /afs/cs.cmu.edu/project/ergo-tsf/sml/thesis/.@sys/unify.sml.bin]
  26694. functor Unify
  26695. [reading /afs/cs.cmu.edu/project/ergo-tsf/sml/thesis/.@sys/term.sml.bin]
  26696. functor Term
  26697. [reading /afs/cs.cmu.edu/project/ergo-tsf/sml/thesis/.@sys/subtypedata.sig.sml.bin]
  26698. signature SUBTYPEDATA
  26699. [reading /afs/cs.cmu.edu/project/ergo-tsf/sml/thesis/.@sys/subtypedata.sml.bin]
  26700. functor SubtypeData
  26701. [reading /afs/cs.cmu.edu/project/ergo-tsf/sml/thesis/.@sys/mltype.sig.sml.bin]
  26702. signature MLTYPE
  26703. [reading /afs/cs.cmu.edu/project/ergo-tsf/sml/thesis/.@sys/subtype.sig.sml.bin]
  26704. signature SUBTYPE
  26705. [reading /afs/cs.cmu.edu/project/ergo-tsf/sml/thesis/.@sys/subtype.sml.bin]
  26706. functor Subtype
  26707. [reading /afs/cs.cmu.edu/project/ergo-tsf/sml/thesis/.@sys/base.sml.bin]
  26708. signature LR_PARSER
  26709. functor Join
  26710. signature ARG_PARSER
  26711. signature STREAM
  26712. signature FIFO
  26713. functor JoinWithArg
  26714. signature TOKEN
  26715. <other binding>
  26716. <other binding>
  26717. signature PARSER_DATA
  26718. signature LR_TABLE
  26719. <other binding>
  26720. signature PARSER
  26721. signature LEXER
  26722. signature ARG_LEXER
  26723. [reading /afs/cs.cmu.edu/project/ergo-tsf/sml/thesis/.@sys/refine.grm.sig.bin]
  26724. signature Refine_LRVALS
  26725. signature Refine_TOKENS
  26726. [reading /afs/cs.cmu.edu/project/ergo-tsf/sml/thesis/.@sys/interface.sig.sml.bin]
  26727.  
  26728. (and it hanged here!  Pressing ^C unhangs it and returns me to the top level.)
  26729.  
  26730. Status: fixed in 0.84
  26731. ----------------------------------------------------------------------
  26732. 563. trig functions return garbage on large args
  26733. Submitter:      Andrzej Filinski, andrzej@cs.cmu.edu
  26734. Date:        May 29, 1992
  26735. Version:        0.75 (also in 0.80)
  26736. System:         all
  26737. Severity:       minor
  26738. Problem:        trig. functions return huge, random results for arguments 
  26739.         greater than approx. 6.747E9 (= 2 pi * maxint).
  26740. Transcript:     Standard ML of New Jersey, Version 75, November 11, 1991
  26741.         Arrays have changed; see Release Notes
  26742.         val it = () : unit
  26743.         - sin 6.746E9;
  26744.         val it = 0.577192771297902 : real
  26745.             (* correct to about 6 significant digits, as expectable *)
  26746.         - sin 6.747E9;
  26747.         val it = ~1.17525075405876E64 : real
  26748. Comments:    The problem seems to be with the overflow handling in 
  26749.         rtoi/drem, file boot/math.sml.
  26750. Status: fixed in 0.84
  26751. ----------------------------------------------------------------------
  26752. 564. problems on HP9000s400
  26753. Submitter:      Kjeld H. Mortensen (kjeld@metasoft.com)
  26754. Date:           6/2/92
  26755. Version:        0.81
  26756. System:         HP9000s400, HPUX 8.0, 32Mb ram, >70Mb swap
  26757. Severity:       minor (but might be major for other people)
  26758. Problem:        Bug in sun2hp.el
  26759. Code:           Do a 'makeml -m68 hpux8'
  26760. Transcript:     
  26761.  
  26762. neptune 125 : makeml -m68 hpux8
  26763. makeml> (cd runtime; make clean)
  26764.         rm -f *.o lint.out prim.s linkdata allmo.s run
  26765. makeml> rm -f mo
  26766. makeml> ln -s ../mo.m68 mo
  26767. makeml> (cd runtime; rm -f run allmo.o allmo.s)
  26768. makeml> (cd runtime; make MACHINE=M68  'CFL=-Wl,-a,archive' 'LIBS=' 'DEFS= -DHPUX -DRUNTIME=\"runtime\"' linkdata)
  26769.         cc -g -Wl,-a,archive -DM68 -DHPUX -DRUNTIME=\"runtime\" -o linkdata linkdata.c
  26770. (cd runtime; grep -v mo/Math.mo IntM68.mos > Tmp.mos)
  26771. makeml> runtime/linkdata [runtime/Tmp.mos]
  26772. runtime/linkdata> as runtime/allmo.s -o runtime/allmo.o
  26773. makeml> (cd runtime; ...)
  26774. makeml>   /lib/cpp -DCALLEESAVE=0 -DM68 -DHPUX -DASM M68.prim.s > prim.s
  26775. makeml>   emacs -batch -l sun2hp.el prim.s prim.s
  26776. label <2> has moved
  26777.  
  26778. makeml>   as -o prim.o prim.s
  26779. as error: "prim.s" line 255: invalid instruction mnemonic (.text)
  26780. as error: "prim.s" line 255: syntax error
  26781. [...rest of error msgs deleted...]
  26782.  
  26783. Comments:
  26784.  
  26785. "label <2> has moved" is printed by the LISP fn replace-all-label-definitions.
  26786. It gets confused because there are more than one label on a line (this
  26787. kind of lines with multible labels are produced by the (new) macro 
  26788. "CHECKLIMIT" in M68.prim.s).
  26789.  
  26790. Fix:
  26791.  
  26792. Replace replace-all-label-definitions with the following fn: (the fix does
  26793. the following: instead of moving to the beginning of the line in order
  26794. to search for the label, the pointer is only moved 2 chars to the left
  26795. of the label.)
  26796.  
  26797. ;; replace-all-label-definitions -- change each of the old label 
  26798. ;; definitions to their new value.
  26799. ;;
  26800. (defun replace-all-label-definitions (labels)
  26801.   (while labels
  26802.     (let* ((cur (car labels))
  26803.        (old-label (label-old-label cur))
  26804.        (point (label-point cur))
  26805.        (new-label (label-new-label cur)))
  26806.       (goto-char (- point 2))
  26807.       (re-search-forward "\\([0-9]+\\):" (point-max) t)
  26808.       (if (not (string-equal (buffer-substring (match-beginning 1)
  26809.                            (match-end 1))
  26810.                  old-label))
  26811.       (error "label <%s> has moved" old-label)
  26812.     (replace-match (concat new-label ":"))))
  26813.       (setq labels (cdr labels))))
  26814. [Reppy:]
  26815. Probably the easiest fix for this is to change the CHECKLIMIT macro to
  26816.  
  26817. #define CHECKLIMIT                                      \
  26818.             1:                         \
  26819.                jgt      2f;                             \
  26820.                lea      1b,a5;                          \
  26821.                rts;                                     \
  26822.             2:
  26823.  
  26824. [Mortensen:]
  26825. I don't think this will work since /lib/cpp on the HP9000s400 (at least
  26826. on ours) converts CHECKLIMIT into
  26827.  
  26828.   1: jgt 2f; lea 1b,a5; rts; 2:
  26829.  
  26830. If sun2hp.el is fixed, anybody can make changes to M68.prim.s without
  26831. having to remember that multible labels on a line are not allowed, just
  26832. because the translator algorithm in sun2hp.el cannot handle it.
  26833.  
  26834. Status: fixed in 0.87
  26835. ----------------------------------------------------------------------
  26836. 565. System.Directory.listDir on SGI
  26837. Submitter:      John Reppy (jhr@research.att.com)
  26838. Date:           June 4, 1992
  26839. Version:        0.81
  26840. System:         SGI 3D/480, SGI Crimson (Irix 4.0.1, 4.0.4)
  26841. Severity:       major
  26842. Problem:
  26843.   Using the function System.Directory.listDir causes
  26844.   sml to go into an uninterruptable infinite loop.
  26845. Transcript:     <transcript of session illustrating problem>
  26846.   Standard ML of New Jersey, Version 0.81, 15 May 1992
  26847.   val it = () : unit
  26848.   - System.Directory.listDir ".";
  26849. Comments:
  26850.   This code often seems to be flakey.  Maybe we should
  26851.   switch to using the underlying OS code.
  26852. Status: fixed
  26853. ----------------------------------------------------------------------
  26854. 566. An addition to sun2hp.el (?)
  26855. Submitter:      Kjeld H. Mortensen (kjeld@metasoft.com)
  26856. Date:           6/2/92
  26857. Version:        0.81
  26858. System:         HP9000s400, HPUX 8.0, 32Mb ram, >70Mb swap
  26859. Severity:       minor (but might be major for other people)
  26860. Problem:        Tranlation entry missing in sun2hp.el
  26861. Code:           Do a 'makeml -m68 hpux8' with the fix to sun2hp.el I send 
  26862.                 earlier
  26863. Transcript:     
  26864.  
  26865. neptune 126 : makeml -m68 hpux8
  26866. makeml> (cd runtime; make clean)
  26867.         rm -f *.o lint.out prim.s linkdata allmo.s run
  26868. makeml> rm -f mo
  26869. makeml> ln -s ../mo.m68 mo
  26870. makeml> (cd runtime; rm -f run allmo.o allmo.s)
  26871. makeml> (cd runtime; make MACHINE=M68  'CFL=-Wl,-a,archive' 'LIBS=' 'DEFS= -DHPUX -DRUNTIME=\"runtime\"' linkdata)
  26872.         cc -g -Wl,-a,archive -DM68 -DHPUX -DRUNTIME=\"runtime\" -o linkdata linkdata.c
  26873. (cd runtime; grep -v mo/Math.mo IntM68.mos > Tmp.mos)
  26874. makeml> runtime/linkdata [runtime/Tmp.mos]
  26875. runtime/linkdata> as runtime/allmo.s -o runtime/allmo.o
  26876. makeml> (cd runtime; ...)
  26877. makeml>   /lib/cpp -DCALLEESAVE=0 -DM68 -DHPUX -DASM M68.prim.s > prim.s
  26878. makeml>   emacs -batch -l sun2hp.el prim.s prim.s
  26879. Wrote /d1/release/tools/njsml/workatt81/src/runtime/prim.s
  26880. makeml>   as -o prim.o prim.s
  26881. as error: "prim.s" line 420: invalid instruction mnemonic (jpl)
  26882. as error: "prim.s" line 420: syntax error
  26883. as error: "prim.s" line 458: invalid instruction mnemonic (jpl)
  26884. as error: "prim.s" line 458: syntax error
  26885. as error: "prim.s" line 479: invalid instruction mnemonic (jpl)
  26886. as error: "prim.s" line 479: syntax error
  26887. as error: "prim.s" line 500: invalid instruction mnemonic (jpl)
  26888. as error: "prim.s" line 500: syntax error
  26889. as error: "prim.s" line 527: invalid instruction mnemonic (jpl)
  26890. as error: "prim.s" line 527: syntax error
  26891.  
  26892. Comments (+Fix?):
  26893.  
  26894. The intruction "jpl" is not know to the sun2hp translator (in fn do-subst).
  26895. I don't know what jpl is supposed to do, but my _guess_ is that it should
  26896. be translated into the branch instruction "bpl.w" (anologious to transl.
  26897. of jeq, jge, ... etc.).
  26898.  
  26899. Shouldn't the line
  26900.  
  26901.   (replace-re "\\<jpl" "bpl.w")
  26902.  
  26903. be added to the fn do-subst in sun2hp.el?
  26904. Status: fixed in 0.90
  26905. ----------------------------------------------------------------------
  26906. 567. makeml does not succeed on HPUX (680x0 problem)
  26907. Submitter:      Kjeld H. Mortensen (kjeld@metasoft.com)
  26908. Date:           6/2/92
  26909. Version:        0.81
  26910. System:         HP9000s400, HPUX 8.0, 32Mb ram, >70Mb swap
  26911. Severity:       minor (but might be major for other people)
  26912. Problem:        A makeml does not succeed (exception raised in Loader)
  26913. Code:           Do a 'makeml -m68 hpux8' with the two fixes to sun2hp.el 
  26914.                 I send earlier
  26915. Transcript:     
  26916.  
  26917. >From time to time, I get different results:
  26918. ---
  26919. > makeml -m68 hpux8
  26920. [...stuff deleted...]
  26921. signature CLEANUP = ...
  26922. signature WEAK = ...
  26923. signature SUSP = ...
  26924. signature POLY_CONT = ...
  26925. signature UNSAFE = ...
  26926. signature SYSTEM = ...
  26927. [closing boot/system.sig]
  26928. signature MATH = ...
  26929. structure Math : MATH
  26930. [closing boot/math.sml]
  26931.  
  26932. [Major collection... 20% used (339576/1680172), 250 msec]
  26933. uncaught exception (Loader): mlyAction
  26934. ---
  26935. > makeml -m68 hpux8
  26936. [...stuff deleted...]
  26937. signature LIST = ...
  26938. signature VECTOR = ...
  26939. signature ARRAY = ...
  26940. signature REAL_ARRAY = ...
  26941. signature BYTEARRAY = ...
  26942. signature IO = ...
  26943. signature BOOL = ...
  26944. signature STRING = ...
  26945. signature INTEGER = ...
  26946. signature BITS = ...
  26947. signature REAL = ...
  26948. signature GENERAL = ...
  26949. [closing boot/perv.sig]
  26950. uncaught exception (Loader): Ord
  26951. ---
  26952. > makeml -m68 hpux8
  26953. [...stuff deleted...]
  26954. structure Core : ...
  26955. [closing boot/dummy.sml]
  26956. signature REF = ...
  26957. signature LIST = ...
  26958. signature VECTOR = ...
  26959. signature ARRAY = ...
  26960. signature REAL_ARRAY = ...
  26961. signature BYTEARRAY = ...
  26962. signature IO = ...
  26963. signature BOOL = ...
  26964. signature STRING = ...
  26965. signature INTEGER = ...
  26966. signature BITS = ...
  26967. signature REAL = ...
  26968. signature GENERAL = ...
  26969. [closing boot/perv.sig]
  26970. uncaught exception (Loader): Ord
  26971. ---
  26972. > makeml -m68 hpux8
  26973. [...stuff deleted...]
  26974. signature CLEANUP = ...
  26975. signature WEAK = ...
  26976. signature SUSP = ...
  26977. signature POLY_CONT = ...
  26978. signature UNSAFE = ...
  26979. signature SYSTEM = ...
  26980. [closing boot/system.sig]
  26981. signature MATH = ...
  26982. structure Math : MATH
  26983. [closing boot/math.sml]
  26984.  
  26985. [Major collection... 20% used (340948/1682456), 333 msec]
  26986. uncaught exception (Loader): Ord
  26987. ---
  26988.  
  26989. Comments:
  26990.  
  26991. I cannot tell if this phenomenon is caused by the two fixes I made to 
  26992. sun2hp.el:
  26993.  
  26994. ;; do-subst -- substitute mnemonics, register names, comment symbols etc.
  26995. ;;
  26996. (defun do-subst ()
  26997. [...]
  26998.   (replace-re "\\<jpl" "bpl.w")
  26999. [...]
  27000.  
  27001. and the other in:
  27002.  
  27003. ;; replace-all-label-definitions -- change each of the old label 
  27004. ;; definitions to their new value.
  27005. ;;
  27006. (defun replace-all-label-definitions (labels)
  27007.   (while labels
  27008.     (let* ((cur (car labels))
  27009.        (old-label (label-old-label cur))
  27010.        (point (label-point cur))
  27011.        (new-label (label-new-label cur)))
  27012.       (goto-char (- point 2))
  27013.       (re-search-forward "\\([0-9]+\\):" (point-max) t)
  27014.       (if (not (string-equal (buffer-substring (match-beginning 1)
  27015.                            (match-end 1))
  27016.                  old-label))
  27017.       (error "label <%s> has moved" old-label)
  27018.     (replace-match (concat new-label ":"))))
  27019.       (setq labels (cdr labels))))
  27020. [Reppy:]
  27021. This bug also occurs on the Sun-3 and NeXT machines.
  27022. It seems to be a general problem with the M68.
  27023. Status: fixed in 0.84
  27024. ----------------------------------------------------------------------
  27025. 568. crash on sparc on large compilations
  27026. Submitter: Pierre Cregut
  27027. Date: 6/5/92
  27028. Version: 0.82
  27029. System: sparc, SunOS 4.2
  27030. Severity: serious
  27031. Problem: 
  27032.   On large compilations (e.g. compiling the compiler) on sparcs that
  27033.   are shared with other large jobs (e.g. lisp or another sml), the
  27034.   compiler will die with a bus error or illegal instruction or something
  27035.   equally drastic.  This is fairly consistent.
  27036. Comments:
  27037.   Can this be avoided by forcing sml to grap a large memory chunk for
  27038.   the heap and hold onto it.
  27039. Status: open
  27040. ----------------------------------------------------------------------
  27041. 569. failed type inference with flexible records
  27042. Submitter:      jont@uk.co.harlqn
  27043. Date:        05-06-92
  27044. Version:        SML of NJ version number 0.75
  27045. System:         Sun 4/330 SunOS 4.1.1
  27046. Severity:       major
  27047. Problem:        Failed type inference with flexible records
  27048. Code:
  27049. fun f x = let val y = #1 x val z = #2 x in (y, z, x:('a * 'b)) end;
  27050. Transcript:
  27051. - fun f x = let val y = #1 x val z = #2 x in (y, z, x:('a * 'b)) end;
  27052. fun f x = let val y = #1 x val z = #2 x in (y, z, x:('a * 'b)) end;
  27053. val f = fn : 'a * 'b -> 'a * 'c * ('a * 'b)
  27054. - f(1,0);
  27055. val it = (1,-,(1,0)) : int * 'a * (int * int)
  27056. Comments:    The type should be 'a * 'b * ('a * 'b)
  27057. Fix:        Better unification I suspect!
  27058. Status: fixed in 0.85
  27059. ----------------------------------------------------------------------
  27060. 570. flexrecord equality types
  27061. Submitter:      Mark Lillibridge (mdl@cs.cmu.edu)
  27062. Date:        6/8/92
  27063. Version:        0.82
  27064. System:         RISC O/S, MIPS (?)
  27065. Severity:       minor
  27066. Problem:        Flexrecords are always assumed to contain non-equality
  27067.         types when this need not be so.  This leads to legal
  27068.         programs being rejected.
  27069. Code:           Consider the following code:
  27070.  
  27071.     fun force_record {x=x, y=y} = 3;
  27072.  
  27073.     fun force_eq x = (x = x);
  27074.  
  27075.         Then, the following function types ok since we close the
  27076. flexrecord before requiring equality:
  27077.  
  27078.     fun bar (r as {x=x, ...}) = (force_record r; force_eq r);
  27079.  
  27080.         But the following function fails with a "equality type
  27081. required" error because we attempt to require that the open flexrecord
  27082. be an equality type:
  27083.  
  27084.     fun foo (r as {x=x, ...}) = (force_eq r; force_record r);
  27085.  
  27086. Transcript:     
  27087.  
  27088. - use "bug.sml";    (* same code as above *)
  27089. val force_record = fn : {x:'a,y:'b} -> int
  27090. val force_eq = fn : ''a -> bool
  27091. val bar = fn : {x:''a,y:''b} -> bool
  27092. bug.sml:7.29-7.56 Error: operator and operand don't agree (equality type required)
  27093.   operator domain: ''Z
  27094.   operand:         {x:'Y,...}
  27095.   in expression:
  27096.     force_eq r
  27097. [closing bug.sml]
  27098.  
  27099. Comments:    This problem is due to incorrect code in the type-handling
  27100. part of the SML/NJ compiler.  Fixing this will require changing the
  27101. definition of types so that flexrecords carry a boolean telling if they
  27102. are required to have only equality types or not.  Unify then needs to be
  27103. updated to use this information in the proper way.
  27104.  
  27105. Status: fixed in 0.85
  27106. ----------------------------------------------------------------------
  27107. 571. no occurs check when instantiating flexrecords
  27108. Submitter:      Mark Lillibridge (mdl@cs.cmu.edu)
  27109. Date:        6/8/92
  27110. Version:        0.82
  27111. System:         RISC O/S, MIPS (?)
  27112. Severity:       minor
  27113. Problem:        When flexrecords are instantiated (additional fields
  27114.         added/closed), no occurs check is done.  The failure to
  27115.         do this can result in cyclic types and hanging the type
  27116.         checker.
  27117. Code:           The following code hangs the typechecker:
  27118.  
  27119.     fun foo {x=x, y=y, z=(z as {...})} = foo z;
  27120.  
  27121. Transcript:     
  27122.     - fun foo {x=x, y=y, z=(z as {...})} = foo z;
  27123.     [hangs here, using more and more space forever]
  27124.  
  27125. Comments:    The problem is in the unify routine.  It needs to do
  27126.         an occurs check whenever it instantiates a flex record.
  27127. Status: fixed in 0.85
  27128. ----------------------------------------------------------------------
  27129. 572. unify doesn't update depth for flex record types
  27130. Submitter:      Mark Lillibridge (mdl@cs.cmu.edu)
  27131. Date:        6/8/92
  27132. Version:        0.82
  27133. System:         RISC O/S, MIPS (?)
  27134. Severity:       major            (* can result in unsoundness *)
  27135. Problem:        The unify routine in the SML/NJ compiler fails to update
  27136.         the depth fields of variables when dealing with flex
  27137.         records.  This causes the type checker to generalize
  27138.         types that should not be generalized.
  27139. Code:           Many examples are possible.  The simplest I can
  27140.         think of is:
  27141.  
  27142.         fun snd {a,b} = b;
  27143.  
  27144.         fun f (x as {a,...}) =
  27145.             let val u = snd x
  27146.             in
  27147.                 u
  27148.             end;
  27149.  
  27150.         Here, snd has type {a:'a,b:'b} -> 'b and acts to extract
  27151.         the b field of an a-b record.
  27152.  
  27153.         So, we start out defining function f.  The (x as
  27154.         {a,...}) in the argument list causes x to be bound to
  27155.         the type {a: 'a#1, ...}.  [#i means the variable has
  27156.         depth i.  I am assuming for this discussion that depths
  27157.         start with 1 and go up 1 for each lambda level.]
  27158.  
  27159.         Now, in the let val u = snd x, we have to unify the type
  27160.         of x with the argument type of snd, namely {a:'c,b:'b}.
  27161.         This results in x being bound to type {a:'a#1, b:'b#2}.
  27162.         Note the error here.  Type 'b should have depth 1 not 2
  27163.         since it is bound at the 1st lambda level (by variable
  27164.         x).  However, due to incorrect code in the unifier, this
  27165.         doesn't happen and 'b has type 2.
  27166.  
  27167.         Thus, when we finish typing the function body we get the
  27168.         type 'b#2, which the depth indicates can be safely
  27169.         generalized.  Thus, the function body has polymorphic
  27170.         type 'c.  This results in f getting type {a:'a, b:'b} ->
  27171.         'c when it should have the type {a:'a, b:'b} -> 'b.
  27172.  
  27173. Transcript:     
  27174.  
  27175.     - fun snd {a,b} = b;
  27176.     val snd = fn : {a:'a,b:'b} -> 'b
  27177.     - fun f (x as {a,...}) = let val u = snd x in u end;
  27178.     val f = fn : {a:'a,b:'b} -> 'c
  27179.     - f {a=0, b=true};
  27180.     val it = - : 'a
  27181.  
  27182. Comments:    The problem is in the handling of types by the SML/NJ
  27183.         compiler.  Flexrecords need to have a depth associated
  27184.         with them just like normal variables.  This is so that
  27185.         you can unify {a:'a#1, ...#1} with {a:'c#3, b:'d#3} and
  27186.         get {a:'a#1, b:'d#1} not {a:'a#1, b:'d#3}.  (Note the
  27187.         depth associated with the dots in that example.  This is
  27188.         the critical information missing from the current type
  27189.         representation.)
  27190.         
  27191. Related-bugs:    Bug reports #521 from Mark Leone, #533 from Richard
  27192.         O'Neill, and #569 from jont@uk.co.harlqn are all just
  27193.         (less clear) instances of this bug.
  27194.  
  27195. Status: fixed in 0.85
  27196. ----------------------------------------------------------------------
  27197. 573. unifier detects spurious cycles with type abbrevs
  27198. Submitter:      Mark Lillibridge (mdl@cs.cmu.edu)
  27199. Date:        6/9/92
  27200. Version:        0.82
  27201. System:         RISC O/S, MIPS (?)
  27202. Severity:       minor
  27203. Problem:        The unifier's occurs check sometimes detects a spurious
  27204.         cycle when a type variable is unified with a type
  27205.         abbreviation that stands for that type variable.
  27206. Code:           
  27207.         type 'a ID = 'a;
  27208.  
  27209.         fun f (x:'a) = (x:'a ID);
  27210.  
  27211.         fun g x = g (f x);
  27212.  
  27213. Transcript:
  27214.  
  27215.     - type 'a ID = 'a;
  27216.     type 'a  ID = 'a
  27217.     - fun f (x:'a) = (x:'a ID);
  27218.     val f = fn : 'a -> 'a ID
  27219.     - fun g x = g (f x);
  27220.     std_in:4.1-4.17 Error: pattern and expression in val rec dec don't agree (circularity)
  27221.       pattern:    'Z ID -> 'Y
  27222.       expression: 'Z -> 'Y
  27223.       in declaration:
  27224.         g = (fn x => g (<exp>))
  27225.  
  27226.     [The above is an incorrect error because 'Z ID = 'Z and hence
  27227. the two types should unify without problems.]
  27228.  
  27229. Status: fixed in 0.85
  27230. ----------------------------------------------------------------------
  27231. 574. redundant patterns in compiler
  27232. Submitter: John Reppy
  27233. Date: 6/12/92
  27234. Version: 0.83
  27235. Severity: minor
  27236. Problem: 
  27237. The compiler reports the following redundant patterns in 0.83:
  27238.  
  27239. modules/sigmatch.sml:0.0 Warning: redundant patterns in match
  27240.         (DATACON {name=n1,rep=r1,...},DATACON {rep=r2,...}) => ...
  27241.   -->   _ => ...
  27242.  
  27243. absyn/printabsyn.sml:0.0 Warning: redundant patterns in match
  27244.         FCTB {def=FCTfct {def=def,param=STRvar <pat>,...},fctvar=FCTvar {access=access,name=fname,...}} => ...
  27245.         FCTB {def=VARfct {def=FCTvar <pat>,...},fctvar=FCTvar {access=access,name=fname,...}} => ...
  27246.   -->   _ => ...
  27247.  
  27248. Status: fixed in 0.85
  27249. ----------------------------------------------------------------------
  27250. 575. line numbers in interactive error messages (same as 552)
  27251. Submitter:      Tim Freeman <tsf@cs.cmu.edu>
  27252. Date:        Sun Jun 14 12:15:40 1992
  27253. Version:        0.80
  27254. System:         Sun 4, mach
  27255. Severity:       minor
  27256. Problem:        The line numbers printed for errors on std_in are erratic.
  27257. Transcript:     
  27258.     % /usr/misc/.sml/bin/sml
  27259.     - aoeiaoei;
  27260.     std_in:3.1-3.8 Error: unbound variable or constructor aoeiaoei
  27261.     - aoeiaoei;
  27262.     std_in:0.0-0.0 Error: unbound variable or constructor aoeiaoei
  27263.     - aoeiaoei
  27264.     = ueoaoeuaoeu;
  27265.     std_in:0.0-0.0 Error: unbound variable or constructor aoeiaoei
  27266.     std_in:4.1-4.11 Error: unbound variable or constructor ueoaoeuaoeu
  27267.     -     
  27268. Comments: 
  27269.     In my opinion, the line numbers reported for
  27270.     the above errors should all have been 1, except the last one should
  27271.     have been 2. 
  27272.  
  27273. Status: same as 552
  27274. ----------------------------------------------------------------------
  27275. 576. pattern matching in interpreter broken
  27276. Submitter:      slind@research.att.com
  27277. Date:           June 14, 1992
  27278. Version:        83
  27279. System:         mips and sparc at least; probably all
  27280. Severity:       major
  27281. Problem:        If System.Control.interp is true, pattern matching is broken.
  27282.                 Manifested with list patterns.
  27283. Transcript:     
  27284.  
  27285.     $ sml
  27286.     Standard ML of New Jersey, Version 0.83, June 12, 1992
  27287.     val it = () : unit
  27288.     - System.Control.interp := true;
  27289.     val it = () : unit
  27290.     - val [_] = [1];
  27291.     std_in:0.0 Warning: binding not exhaustive
  27292.             _ :: nil = ...
  27293.  
  27294.     uncaught exception Match
  27295.     - System.Control.interp := false;
  27296.     val it = () : unit
  27297.     - val [_] = [1];
  27298.     std_in:0.0 Warning: binding not exhaustive
  27299.             _ :: nil = ...
  27300.     - ^D
  27301.     $ 
  27302.  
  27303. Comments:
  27304.  
  27305. There is a bug in the interpreter since version 77 caused by a change in
  27306. the representation of data constructors.
  27307. - System.Control.interp:= true;
  27308. val it = () : unit
  27309. - val [x] = [1];
  27310. std_in:3.1-3.13 Warning: binding not exhaustive
  27311.         x :: nil = ...
  27312.  
  27313. uncaught exception Match
  27314. -
  27315. The reason is that cons is tagged with UNTAGGEDREC 2 and the case UNTAGGEDREC
  27316. is not treated by the switch.
  27317. Lal and I have infered that the only thing the switch interpretor had to
  27318. figure out is whether the constructor is tagged or not. So the only necessary
  27319. lines to add are:
  27320. -cregut->diff codegen/interp.sml /usr/local/sml/77/src/codegen/interp.sml
  27321.  
  27322. 291,296d290
  27323. <            | f((DATAcon(_,UNTAGGEDREC _),ans)::rest) =
  27324. <               let val rest' = f rest
  27325. <                   val ans' = M ans
  27326. <                in fn x => if (U.boxed x) then ans' else rest' x
  27327. <               end
  27328. <
  27329.  
  27330. Is it true or do we need something else ?
  27331.  
  27332. Pierre
  27333.  
  27334. Status: fixed in 0.86
  27335. --------------------------------------------------------------------
  27336. 577. use of vectors crashes NeXT
  27337. Submitter:      Richard O'Neill <richard@smaug.questor.wimsey.bc.ca>
  27338. Date:        Thu Jun 18 13:24:53 PDT 1992
  27339. Version:        0.75
  27340. System:         NeXTstation, OS2.1  and NeXTstation Turbo Color, OS 2.2.
  27341. Severity:       Major.
  27342. Problem:        
  27343.  
  27344. Extensive use of vectors (and probably arrays) when running on NeXTs
  27345. causes SML to crash with either "Bus Error", "Segmentation Fault",
  27346. "Illegal instruction" or "EMT trap". The same code, when run on SPARC
  27347. based Sun machines does not exhibit the same problem.
  27348.  
  27349. The code below creates a function called 'bug', which takes an integer
  27350. argument. The larger the argument, the more likely SML is to crash,
  27351. values like 10000 create an almost immediate crash, values such as 500
  27352. sometimes work and sometimes crash SML. (The code is for example purposes
  27353. only, I don't actually use code as inefficient as this normally! ;o)
  27354.  
  27355. Code (stored in file "bug.sml"):
  27356.  
  27357.     open Vector
  27358.  
  27359.     fun update(array,index,value) = 
  27360.     let
  27361.         fun copy i = 
  27362.  
  27363.         if i = index then value
  27364.         else sub(array,i)
  27365.         val size = length array
  27366.     in
  27367.         if index < size then
  27368.         tabulate (size,copy)
  27369.         else
  27370.         raise Vector.Subscript
  27371.     end
  27372.  
  27373.     fun reverse original =
  27374.     let
  27375.         val size = length original
  27376.         fun rev (current,count) =
  27377.         if count < size then
  27378.             let
  27379.             val count'  = count + 1
  27380.             val current' =
  27381.                 update(current, count, sub(original, size-count'))
  27382.             in
  27383.             rev (current', count')
  27384.             end
  27385.         else current
  27386.     in
  27387.         rev (original,0)
  27388.     end
  27389.  
  27390.     fun bug n = reverse (tabulate (n, fn x => x))
  27391.  
  27392. Transcript:
  27393.  
  27394. NeXT-Mach% sml
  27395. Standard ML of New Jersey, Version 75, November 11, 1991
  27396. Arrays have changed; see Release Notes
  27397. val it = () : unit
  27398. - use "bug.sml";
  27399. [opening bug.sml]
  27400. open Vector
  27401. val update = fn : 'a vector * int * 'a -> 'a vector
  27402. val reverse = fn : 'a vector -> 'a vector
  27403. val bug = fn : int -> int vector
  27404. [closing bug.sml]
  27405. val it = () : unit
  27406. - bug 500;
  27407. val it = - : int vector
  27408. - bug 500;
  27409. Bus error
  27410. NeXT-Mach% 
  27411.  
  27412. NeXT-Mach% sml
  27413. Standard ML of New Jersey, Version 75, November 11, 1991
  27414. Arrays have changed; see Release Notes
  27415. val it = () : unit
  27416. - use "bug.sml";
  27417. [opening bug.sml]
  27418. open Vector
  27419. val update = fn : 'a vector * int * 'a -> 'a vector
  27420. val reverse = fn : 'a vector -> 'a vector
  27421. val bug = fn : int -> int vector
  27422. [closing bug.sml]
  27423. val it = () : unit
  27424. - bug 5000;
  27425. EMT trap
  27426. NeXT-Mach%
  27427. NeXT-Mach% sml
  27428. Standard ML of New Jersey, Version 75, November 11, 1991
  27429. Arrays have changed; see Release Notes
  27430. val it = () : unit
  27431. - use "bug.sml";
  27432. [opening bug.sml]
  27433. open Vector
  27434. val update = fn : 'a vector * int * 'a -> 'a vector
  27435. val reverse = fn : 'a vector -> 'a vector
  27436. val bug = fn : int -> int vector
  27437. [closing bug.sml]
  27438. val it = () : unit
  27439. - bug 5000;
  27440. Bus error
  27441.  
  27442. Comments:
  27443.  
  27444. It gives an idea how 'wild' the crash is since the latter two cases in
  27445. the transcript should be identical, and aren't. I suspect it is some
  27446. kind of memory allocation bug, but who knows....
  27447.  
  27448. Comment: [dbm, 10/29/92]
  27449.   Couldn't reproduce this on a Sun 3 with 0.91.  Either the bug is
  27450.   cured or it is NeXT specific.
  27451. Status: fixed in 0.92
  27452. ----------------------------------------------------------------------
  27453. 578. chatting (in runtime system) doesn't flush stdout
  27454. Submitter:      Mark Leone (mleone@cs.cmu.edu)
  27455. Date:           June 24, 1992
  27456. Version:        80
  27457. System:         all
  27458. Severity:       minor
  27459. Problem:        chatting() doesn't flush stdout
  27460. Code:           
  27461. Transcript:     
  27462. Comments:    GC messages (and other diagnostic compiler output)
  27463.         sometimes appear before things that have already been 
  27464.         printed to stdout  (e.g. when redirecting batch compiler 
  27465.         output to a log file).  This can make it hard to debug 
  27466.         the compiler.
  27467. Fix:        Add "fflush(stdout)" to chatting() in runtime/run.c
  27468. Status: not a bug (inaccurate report according to awa)
  27469. ----------------------------------------------------------------------
  27470. 579. Lexing an illegal token can lead to infinite loop
  27471. Submitter:      Andrew Tolmach (apt@research.att.com)
  27472. Date:        30 June
  27473. Version:        0.83
  27474. System:         MIPS and SPARC
  27475. Severity:       
  27476. Problem:        Lexing an illegal token can lead to infinite loop.
  27477. Code:           Typing an arbitrary control character (such as CTRL/A),
  27478.         followed by return, sends system into an infinite loop.
  27479. Transcript:     - ^A
  27480.         std_in:0.0 Error: illegal token
  27481.         ... (infinite loop) ...
  27482. Comments:    (1) Looping doesn't occur if illegal token is followed by a 
  27483.             complete legal phrase, e.g., ^A1;
  27484.         (2) Loop can be interrupted with CTRL/C.
  27485.         (3) Didn't occur in 0.82.
  27486. Fix: 
  27487.   Exception handler in ml.lex.sml uses Reject instead of Internal.Reject
  27488.   when Internal is not open, thus producing a handler for all exceptions.
  27489.   Change Reject to Internal.Reject in lexgen.
  27490. Status: fixed in 0.84
  27491. ----------------------------------------------------------------------
  27492. 580. System.Compile, System.Env broken in 0.83
  27493. Submitter:      Emden R. Gansner erg@ulysses.att.com
  27494. Date:           3 July 1992
  27495. Version:        0.83
  27496. System:         Sparc 2, SunOS 4.1
  27497. Severity:       major
  27498. Problem:        Support for separate compilation is broken
  27499. Code:           
  27500. fun bug () = let
  27501.   open System.Compile System.Env
  27502.   val staticPerv = staticPart(!pervasiveEnvRef)
  27503.   val ins = open_string "signature T = sig end"
  27504.   val source = makeSource("<string>", 1, ins, false, std_out)
  27505.   val (static, _) = compile(source,staticPerv)
  27506.   in
  27507.     changeLvars static
  27508.   end
  27509. Transcript:
  27510. Standard ML of New Jersey, Version 0.83, June 12, 1992
  27511. val it = () : unit
  27512. - use "bug.sml";
  27513. val bug = fn : unit -> System.Compile.staticUnit
  27514. [closing bug.sml]
  27515. val it = () : unit
  27516. - bug();
  27517. Error: Compiler bug: CompileUnit 2
  27518. Status: fixed in 0.86
  27519. ----------------------------------------------------------------------
  27520. 581. line numbers in error and warning messages
  27521. Submitter: Andrew Appel
  27522. Date: 7/3/92
  27523. Version: 0.83
  27524. Severity: serious
  27525. Problem: 
  27526.   Many of the error and warning messages have line numbers of 0.0.
  27527. Comments: Something wrong in the use of markabsyn.
  27528. Status: fixed in 0.88
  27529. ----------------------------------------------------------------------
  27530. 582. interaction of open declarations and eval_stream
  27531. Submitter:      Andrew Tolmach (apt@research.att.com)
  27532. Date:        7 July 92
  27533. Version:        0.83
  27534. System:         MIPS riscos
  27535. Severity:       minor
  27536. Problem:        If an open declaration is evaluated by 
  27537.         System.Compile.eval_stream, the resulting first-class
  27538.         environment is inconsistent: the static environment
  27539.         contains the elements of the opened structure, but the
  27540.         structure itself is not included in the dynamic environment.
  27541.         Subsequent attempts to look up these elements in the
  27542.         first-class environment trigger IntMapF exceptions.
  27543. Transcript:
  27544.  
  27545. Standard ML of New Jersey, Version 0.83, June 12, 1992
  27546. val it = () : unit
  27547. - open System.Compile System.Env System.Symbol;
  27548. open Compile Env Symbol
  27549. - structure Fred = struct val a = 10 end;
  27550. structure Fred : 
  27551.   sig
  27552.     val a : int
  27553.   end
  27554. - val e = eval_stream(open_string "open Fred", 
  27555. = layerEnv(!topLevelEnvRef,!pervasiveEnvRef));
  27556. open Fred
  27557. [closing <instream>]
  27558. val e = prim? : environment
  27559. - val e' = layerEnv(e,!pervasiveEnvRef); 
  27560. val e' = prim? : environment
  27561. - eval_stream(open_string "a",e');
  27562. [closing <instream>]
  27563.  
  27564. uncaught exception IntmapF
  27565.  
  27566. Fix: (suggested by Tolmach)
  27567.     A top-level open should create a new structure entry in the 
  27568.     dynamic environment, and paths for entries in the static 
  27569.     environment should be adjusted to point at this new entry.
  27570. Fix: (implemented in 0.91)
  27571.   A top-level open causes all the runtime components of the structures
  27572.   opened to be rebound in the top-level environment.
  27573. Status: fixed in 0.91
  27574. ----------------------------------------------------------------------
  27575. 583. catalogEnv raises Match exception
  27576. Submitter:      Andrew Tolmach  (apt@research.att.com)
  27577. Date:        7 July 92
  27578. Version:        0.83
  27579. System:         Mips riscos
  27580. Severity:       minor
  27581. Problem:        Executing 
  27582.             System.Env.catalogEnv(staticPart (!pervasiveEnvRef))
  27583.         provokes a Match exception.
  27584.  
  27585. Comment:    Problem is evidently with 
  27586.         modules/moduleutil.sml:sortEnvBindings.binderGt,
  27587.         which contains an incomplete match.  Perhaps TAB binding
  27588.         entries need to be included?
  27589. Status: fixed in 0.85
  27590. ----------------------------------------------------------------------
  27591. 584. infinite loop in cpsopt
  27592. Submitter: John Reppy (jhr@research.att.com)
  27593. Date: 7/10/92
  27594. Version: 0.84
  27595. Severity: major
  27596. Problem: 
  27597.   The following program causes an infinite loop in cpsopt (I assume
  27598.   that this is another case of infinite loop unrolling):
  27599. Code: 
  27600.   fun foo () = let fun loop () = loop () in loop () end;
  27601. Status: fixed in 0.86
  27602. ----------------------------------------------------------------------
  27603. 585. wrong type for notb in perv.sig
  27604. Submitter: Nick Haines (Nick_Haines@VOILA.VENARI.CS.CMU.EDU)
  27605. Date: 7/10/92
  27606. Version: 0.84
  27607. Severity: minor
  27608. Problem: 
  27609. In boot/perv.sig, the type of `notb' is given as
  27610.  
  27611.         int * int -> int
  27612.  
  27613. not as
  27614.  
  27615.         int -> int
  27616.  
  27617. as it should be (and as boot/perv.sml has it).
  27618. Fix: change the type in perv.sig
  27619. Status: fixed in 0.86
  27620. ----------------------------------------------------------------------
  27621. 586. uncaught Match in interpreter
  27622. Submitter:      John Reppy (jhr@research.att.com)
  27623. Date:        July 10, 1992
  27624. Version:        0.77 and later
  27625. System:         any
  27626. Severity:       minor
  27627. Problem:        an uncaught exception Match in the interpreter
  27628. Code:
  27629.   System.Control.interp := true;
  27630.   datatype t = Z | S of t;
  27631.   fn (S _) => 0;
  27632. Transcript:
  27633.   Standard ML of New Jersey, Version 0.77, February 24, 1992
  27634.   Arrays have changed; see Release Notes
  27635.   val it = () : unit
  27636.   - datatype t = Z | S of t; System.Control.interp := true; fn (S _) => 0;
  27637.   datatype  t
  27638.   con S : t -> t
  27639.   con Z : t
  27640.   val it = () : unit
  27641.   std_in:2.57-2.69 Warning: match not exhaustive
  27642.           S _ => ...
  27643.  
  27644.   uncaught exception Match
  27645.   - 
  27646. Comments: Mark Lillibridge tracked this down to codegen/interp.sml;
  27647.   specifically, the function "f" in the case
  27648.     SWITCH(e,_, l as (DATAcon _, _)::_, d) => ...
  27649.   The problem seems to be a result of the changes in the datatype
  27650.   representation.
  27651.  
  27652.   Is this the same as bug #576?
  27653.   Bug # 591 is another instance of this
  27654. Status: fixed in 0.86
  27655. ----------------------------------------------------------------------
  27656. 587. Compiler bug: ModuleUtil: Instantiate:getSigPos.2<Argument>
  27657. Submitter: Olivier Nora
  27658. Date: 7/14/92
  27659. Version: 0.84
  27660. Severity: major
  27661. Problem: 
  27662.   Following code produces compiler bug:
  27663.   ModuleUtil: Instantiate:getSigPos.2<Argument>
  27664. Code:
  27665. signature SEQUENCE =
  27666.   sig
  27667.     exception LoopingError
  27668.     type 'a sequence
  27669.     val read        : '1a sequence  -> ('1a * '1a sequence) option
  27670.     val append : '1a list * '1a sequence -> '1a sequence
  27671.     val add_to : '1a sequence -> '1a sequence -> unit
  27672.     val app    : ('2a -> '2b) sequence -> '2a sequence 
  27673.                                             -> '2b sequence
  27674.     val value  : '1a -> '1a sequence
  27675.     val empty_sequence : unit -> '1a sequence
  27676.   end
  27677.  
  27678. signature SEMANTIC_VALUE = 
  27679.   sig
  27680.     type 'a semantic_type
  27681.     type semantic_value
  27682.     type 'a sequence
  27683.     exception SemanticValueError of string
  27684.     val add_semantic_value : semantic_value -> semantic_value -> unit
  27685.     val cast_from : 'a semantic_type -> semantic_value -> 'a sequence
  27686.     val cast_to : 'a semantic_type -> 'a sequence -> semantic_value
  27687.     val void_semantic_value : semantic_value
  27688.   end
  27689.  
  27690. funsig MK_SEMANTIC_VALUE (Sequence : SEQUENCE) = SEMANTIC_VALUE
  27691.  
  27692. functor MkWhole (functor MkSemanticValue : MK_SEMANTIC_VALUE) =
  27693.   struct
  27694.   end
  27695. Comment: [Cregut]
  27696. The bug can be obtained by the simple following code:
  27697.  
  27698. signature A=sig end
  27699. signature B=sig functor f():A end;
  27700.  
  27701. and comes from the fact that A is declared before so contains
  27702. no arguments. The fix is a 3 lines changed in extern.sml that
  27703. ask the function not to worry if the argument is not there.
  27704. It should be in .85
  27705.  
  27706. Status: fixed in 0.85
  27707. ----------------------------------------------------------------------
  27708. 588. wrong printing of flex records with no fields
  27709. Submitter:      Mark Lillibridge (mdl@cs.cmu.edu)
  27710. Date:        July 14, 1992
  27711. Version:        0.83
  27712. Severity:       minor
  27713. Problem:        The abstract syntax printing routines print out flex
  27714.         records with no fields wrong.  I.e., as "{,...}" instead
  27715.         of "{...}".
  27716.  
  27717. Code:           (fn {...} => ()) 3;
  27718.  
  27719. Transcript:
  27720.  
  27721. - (fn {...} => ()) 3;
  27722. std_in:18.1-18.18 Error: operator and operand don't agree (type mismatch)
  27723.   operator domain: {...}
  27724.   operand:         int
  27725.   in expression:
  27726.     ((fn {,...} => ())) 3
  27727.       ^^^^-------------------- note error
  27728.  
  27729. Comments: same as bug #468 which was mislabeled
  27730. Status: fixed in 0.85
  27731. ----------------------------------------------------------------------
  27732. 589. occurs check with nonstrict type abbreviations
  27733. Submitter:      Mark Lillibridge (mdl@cs.cmu.edu)
  27734. Date:        July 14, 1992
  27735. Version:        0.83
  27736. Severity:       minor
  27737. Problem:        The occurs check is done wrong in the presense of
  27738.         non-strict type abbreviations.
  27739.  
  27740. Code:           type 'a CON = int;
  27741.  
  27742.         fun foo (x:'a) = (3:'a CON);
  27743.  
  27744.         fun bar x = bar (foo x);
  27745.  
  27746. Transcript:
  27747.         - type 'a CON = int;
  27748.         type 'a  CON = int
  27749.         - fun foo (x:'a) = (3:'a CON);
  27750.         val foo = fn : 'a -> 'a CON
  27751.         - fun bar x = bar (foo x);
  27752.         [type checker hangs at this point]
  27753.  
  27754. Status: fixed in 0.85
  27755. ----------------------------------------------------------------------
  27756. 590. Some user type variable names are handled incorrectly.
  27757. Submitter:      Mark Lillibridge (mdl@cs.cmu.edu)
  27758. Date:        July 14, 1992
  27759. Version:        0.83
  27760. Severity:       minor
  27761. Problem:        Some user type variable names are handled incorrectly.
  27762.  
  27763. Code:           val x : '_1abcd = 3;
  27764.  
  27765. Transcript:
  27766. - val x : '_1abcd = 3;
  27767. std_in:0.0-0.0 Error: pattern and expression in val dec don't agree (type mismatch)
  27768.   pattern:    '1_1abcU
  27769.   expression: int
  27770.   in declaration:
  27771.     x : '1_1abcU = 3
  27772.        ^^^^------------------- note no 'd' on end!
  27773.  
  27774. Comment:
  27775.   Note that this kind of type variable name is no longer legal
  27776.   as of 0.85.
  27777. Status: fixed in 0.85
  27778. ----------------------------------------------------------------------
  27779. 591. uncaught Match evaluating fn expressions.
  27780. Submitter: Elsa Gunter
  27781. Date: 7/15/92
  27782. Version: 0.84
  27783. Severity: major
  27784. Problem: 
  27785.   Match exception raised when evaluating innocuous "fn" expressions.
  27786.   This was in a version of 0.84 in which eXene was loaded.
  27787. Transcript: 
  27788.   - fn (th :: _) => [th] | nil => nil;
  27789.  
  27790.   uncaught exception Match
  27791.  
  27792.   - fn (SOME x) => [x] 
  27793.   = | NONE => [];
  27794.  
  27795.   uncaught exception Match
  27796. Comment:  does not occur in plain 0.84
  27797.       Confirmed to be an instance of bug #586
  27798. Status: open
  27799. ----------------------------------------------------------------------
  27800. 592. unhelpful error messages for record type mismatches
  27801. Submitter:      thomas yan, tyan@cs.cornell.edu
  27802. Date:        7/17/92
  27803. Version:        <= .85
  27804. Severity:       minor, but annoying
  27805. Problem:        unhelpful error messages for record type mismatches
  27806. Code:           val {e:int, g:int, i:int, k:int option, m:int, p:int, ...} =
  27807.             {e=0, g=0, j=0, k=[0], n=0, p=0, r=0, t=0, w=0, x=0, z=0}
  27808.         (* and similar variations *)
  27809. Transcript:     
  27810.     - val {e:int, g:int, i:int, k:int option, m:int, p:int, ...} =
  27811.       {e=0, g=0, j=0, k=[0], n=0, p=0, r=0, t=0, w=0, x=0, z=0};
  27812.     std_in:0.0-331.117 Error: pattern and expression in val dec don't agree (record labels)
  27813.       pattern:    {e:int,g:int,i:int,k:int option,m:int,p:int,...}
  27814.       expression: {e:int,g:int,j:int,k:int list,n:int,p:int,r:int,t:int,w:int,x:int,z:int}
  27815.       in declaration:
  27816.         {e=e : int,g=g : int,i=i : int,k=k : int option,m=m : int,p=p : int,...} = {e=0,g=0,j=0,k=0 :: nil,n=0,p=0,r=0,t=0,w=0,x=0,z=0}
  27817.  
  27818.      - val {e:int, g:int, i:int, k:int option, m:int, p:int} = {e=0, g=0, j=0, k=[0], n=0, p=0};
  27819.      std_in:0.0-331.87 Error: pattern and expression in val dec don't agree (tycon mismatch)
  27820.        pattern:    {e:int,g:int,i:int,k:int option,m:int,p:int}
  27821.        expression: {e:int,g:int,j:int,k:int list,n:int,p:int}
  27822.        in declaration:
  27823.          {e=e : int,g=g : int,i=i : int,k=k : int option,m=m : int,p=p : int} = {e=0,g=0,j=0,k=0 :: nil,n=0,p=0}
  27824.  
  27825. Comments:    the error messages should indicate which labels are a) ok, b)
  27826.         extra/mispelled, c) missing.  also, (and this is a problem in
  27827.         general with type error messages), the field type mismatches
  27828.         should be highlighted, as just "tycon mismatch" gives one no
  27829.         idea where the mismatch is.
  27830.  
  27831. Fix:        use some kind of field by field comparison of the pattern and
  27832.         expression (a 2-column format, while verbose, might work well),
  27833.         perhaps first listing all fields that match, then listing all
  27834.         labels with mismatched types, then extra labels in the
  27835.         expression, then (possibly even for flex records) omitted
  27836.         labels.
  27837.  
  27838. Status: open
  27839. ----------------------------------------------------------------------
  27840. 593. Compiler bug from bad overload declaration
  27841. Submitter:      Mark Lillibridge (mdl@cs.cmu.edu)
  27842. Date:        7/17/92
  27843. Version:        0.83
  27844. System:         Sparc
  27845. Severity:       minor
  27846. Problem:        When values supplied in an overload declaration fail to
  27847.         meet the spec given, a compiler bug sometimes occurs.
  27848. Code:        
  27849.         fun baz [x] = x + 1;
  27850.         overload quux : ('a -> 'a) as tl and baz;
  27851.  
  27852. Transcript:
  27853.         - fun baz [x] = x + 1;
  27854.         std_in:0.0 Warning: match not exhaustive
  27855.                 x :: nil => ...
  27856.         val baz = fn : int list -> int
  27857.         - overload quux : ('a -> 'a) as tl and baz;
  27858.         Error: Compiler bug: matchScheme: bad tyvar 0
  27859. Status: fixed in 0.93c
  27860. ----------------------------------------------------------------------
  27861. 594. "val _ = =;" now giving a different (wrong) error (same as 549)
  27862. Submitter:      Mark Lillibridge (mdl@cs.cmu.edu)
  27863. Date:        7/17/92
  27864. Version:        0.83
  27865. System:         Sparc
  27866. Severity:       minor
  27867. Problem:        "val _ = =;" now giving a different (wrong) error
  27868.  
  27869. Code:        
  27870.         val _ = =;
  27871.  
  27872. Transcript:
  27873.         - val _ = =;
  27874.         std_in:7.9 Error: nonfix identifier required
  27875.         Error: Compiler bug: elabVB
  27876.  
  27877. Comment:
  27878.         This bug report is an addeneum to bug report #549.  That
  27879. bug reported that a non-handled Match exception occured on this program.
  27880. This bug report is to report that that no longer happens in 0.83.
  27881. Instead, a "elabVB" compiler bug occurs.  Still a bug though.
  27882.  
  27883. Status: same as 549
  27884. ----------------------------------------------------------------------
  27885. 595. uncaught exception UnboundTable compiling bogus signature
  27886. Submitter:     John Reppy
  27887. Date:         July 22, 1992
  27888. Version:     0.85
  27889. System:     Sun 4/75
  27890. Severity:     minor
  27891. Problem:    uncaught exception UnboundTable in compiler
  27892. Code:
  27893.   signature JGRAPH =
  27894.     sig
  27895.       structure IO
  27896.     end
  27897.  
  27898.   functor JGraph (IO : IO) : JGRAPH =
  27899.     struct
  27900.     end
  27901.  
  27902. Transcript: 
  27903.   Standard ML of New Jersey, Version 0.85, July 17, 1992
  27904.   val it = () : unit
  27905.   - use "bug.sml";
  27906.   bug.sml:3.5-3.13 Error: syntax error: replacing STRUCTURE with EQTYPE
  27907.   bug.sml:1.1-8.5 Error: unmatched type spec: IO
  27908.   [closing bug.sml]
  27909.  
  27910.   uncaught exception UnboundTable
  27911.   - 
  27912. Comments:
  27913.   If you type the code into the top-level loop, you get a different
  27914.   kind of syntax error, and the bug doesn't occur.
  27915. Status: fixed in 0.89
  27916. ----------------------------------------------------------------------
  27917. 596. bad line number info in error messages
  27918. Submitter: Andrew Appel
  27919. Date: 7/24/92
  27920. Version: 0.86
  27921. Severity: major
  27922. Problem: 
  27923.   Many error messages say line "0.0-0.0".
  27924. Status: fixed in 0.88
  27925. ----------------------------------------------------------------------
  27926. 597. Compiler bug: errors in cps/generic/extract
  27927. Submitter: Magnus Carlsson <magnus@cs.chalmers.se>
  27928. Date: 7/26/92
  27929. Version: 0.75
  27930. System: Sun-4
  27931. Severity: major
  27932. Problem: 
  27933.   Following code causes Compiler bug: errors in cps/generic/extract.
  27934. Code: 
  27935.     datatype 'a fcont = Fcont of 'a fcont cont | Thrown of 'a;
  27936.  
  27937.     case callcc Fcont of
  27938.     Fcont k => throw k (Thrown 5)
  27939.       | Thrown i => i;
  27940. Transcript: 
  27941.     animal> smlc
  27942.     Standard ML of New Jersey, Version 75, November 11, 1991
  27943.     Arrays have changed; see Release Notes
  27944.     val it = () : unit
  27945.     - use "callcc-error.ml";
  27946.     [opening callcc-error.ml]
  27947.     datatype 'a  fcont
  27948.     con Fcont : 'a fcont cont -> 'a fcont
  27949.     con Thrown : 'a -> 'a fcont
  27950.     Error: Compiler bug: errors in cps/generic/extract
  27951.     [closing callcc-error.ml]
  27952.     -
  27953. Status: fixed in 0.89
  27954. ----------------------------------------------------------------------
  27955. 598. Compiler bug: applyTyfun: not enough arguments
  27956. Submitter: Andrew Appel
  27957. Date: 7/27/92
  27958. Version: 0.86
  27959. Severity: minor
  27960. Problem: 
  27961.     Compiler bug after incorrect datatype/withtype declaration.
  27962. Code:
  27963.     datatype 'a t = A of u
  27964.       withtype 'a u = 'a list
  27965. Transcript: 
  27966.     foo.sml:0.0 Error: type constructor u has the wrong number of arguments: 0
  27967.     Error: Compiler bug: applyTyfun: not enough arguments
  27968. Comment: [mdl]
  27969.     Turned out to be another bug in the module system where a bad
  27970. tycon was returned in spite of an error being detected.  Fix is to
  27971. change so that ERRORtyc is returned on error.  The diffs to fix it
  27972. follow.  I tested the change on the 86 sources and it seems to work
  27973. fine.
  27974. Fix:
  27975. diff moduleutil.sml.86 moduleutil.sml:
  27976. ------------------ cut here ------------------
  27977. 524c524
  27978. < fun checkArity(tycon, arity,err) =
  27979. ---
  27980. > fun checkArity(tycon, arity,err,result) =
  27981. 526c526
  27982. <     of ERRORtyc => ()
  27983. ---
  27984. >     of ERRORtyc => result
  27985. 529,531c529,532
  27986. <        then err COMPLAIN ("type constructor "^(Symbol.name(tycName(tycon)))^
  27987. <              " has the wrong number of arguments: "^makestring arity)
  27988. <        else ()
  27989. ---
  27990. >        then (err COMPLAIN ("type constructor "^(Symbol.name(tycName(tycon)))^
  27991. >              " has the wrong number of arguments: "^makestring arity);
  27992. >         ERRORtyc)
  27993. >        else result
  27994. 537,538c538,539
  27995. <             (checkArity(spec,arity,err);
  27996. <              RELtyc{name=name,pos=(relpos,pos)})
  27997. ---
  27998. >             checkArity(spec,arity,err,
  27999. >                  RELtyc{name=name,pos=(relpos,pos)})
  28000. 540,541c541,542
  28001. <             (checkArity(spec,arity,err);
  28002. <              RELtyc{name=name,pos=pos})
  28003. ---
  28004. >             checkArity(spec,arity,err,
  28005. >                  RELtyc{name=name,pos=pos})
  28006. 544c545
  28007. <           | (TYCbind tyc,_,_) => (checkArity(tyc,arity,err); tyc)
  28008. ---
  28009. >           | (TYCbind tyc,_,_) => checkArity(tyc,arity,err,tyc)
  28010.  
  28011. Status: fixed in 0.88
  28012. ----------------------------------------------------------------------
  28013. 599. symbolic path names are reversed in error messages.
  28014. Submitter: Andrew Appel
  28015. Date: 7/27/92
  28016. Version: 0.86
  28017. Severity: minor
  28018. Problem: 
  28019.   Symbolic path names are reversed in error messages.
  28020.   What should be "MipsInstrSet.instruction", is instruction.MipsInstrSet (etc.)
  28021. Transcript: 
  28022.     mips/mips.sml:0.0 Error: Inconsistent arities in sharing type instruction.MipsIn
  28023.     strSet = instruction.C.<Parameter> : instruction.MipsInstrSet has arity 1 and in
  28024.     struction.C.<Parameter> has arity 0.
  28025.     mips/mips.sml:0.0 Error: Inconsistent arities in sharing type sdi.MipsInstrSet =
  28026.      sdi.C.<Parameter> : sdi.MipsInstrSet has arity 1 and sdi.C.<Parameter> has arit
  28027. Status: fixed in 0.89
  28028. ----------------------------------------------------------------------
  28029. 600. Core dump running sourcegroup 2.1
  28030. Submitter: Amy Felty
  28031. Date: 7/28/92
  28032. Version: 0.86
  28033. System: Sparc, SunOS 4.1
  28034. Severity: major
  28035. Problem: 
  28036.   Core dump running sourcegroup 2.1
  28037. Code: 
  28038.   SMLTool.targetNamer := SourceAction.sysBinary;
  28039.   System.Control.Print.signatures := 0;
  28040.   System.Control.indexing := true;
  28041.  
  28042.   structure SG = SourceGroup;
  28043.   structure SA = SourceAction;
  28044.   structure FL = FileList;
  28045.  
  28046.   fun smlFiles dirs =
  28047.       FL.extensionsOnly ["fun", "sig", "sml"] (FL.inDir (false, dirs));
  28048.  
  28049.   fun mlyaccFiles dirs =
  28050.       FL.extensionsOnly ["lex", "grm"] (FL.inDir (false, dirs));
  28051.  
  28052.   val mlyaccGroup = 
  28053.       SG.create [SG.Sources (FL.inFile ["mlyacc/base/base.files"])];
  28054. Transcript: 
  28055.   - lutece:working> sml-sg
  28056.   Standard ML of New Jersey, Version 0.86, July 22, 1992
  28057.     with SourceGroup 2.1 built on Fri Jul 24 10:48:49 EDT 1992
  28058.   val it = () : unit
  28059.   - use "build-elp.sml";
  28060.   val it = () : unit
  28061.   val it = () : unit
  28062.   val it = () : unit
  28063.   structure SG : SOURCEGROUP
  28064.   structure SA : SOURCEACTION
  28065.   structure FL : FILELIST
  28066.   val smlFiles = fn : string list -> string list
  28067.   val mlyaccFiles = fn : string list -> string list
  28068.   Segmentation fault
  28069.   lutece:working>
  28070. Status: fixed in 0.87
  28071. ----------------------------------------------------------------------
  28072. 601. bad implementation of Assembly.A.logb
  28073. Submitter:      John Reppy (jhr@research.att.com)
  28074. Date:        7/29/92
  28075. Version:        0.75-0.85 (probably earlier versions too)
  28076. System:         SPARC
  28077. Severity:       minor
  28078. Problem:        The implementation of logb in runtime/SPARC.prim.s
  28079.         doesn't work for 0.0
  28080. Code:
  28081.   (System.Unsafe.Assembly.A.logb 0.0)
  28082. Transcript:
  28083.   Standard ML of New Jersey, Version 0.86, July 22, 1992
  28084.   val it = () : unit
  28085.   - (System.Unsafe.Assembly.A.logb 0.0);
  28086.   val it = 
  28087.   uncaught exception Boxity
  28088. Fix:  "beq 1f" should be "beq 2f"
  28089. Status: fixed in 0.87
  28090. ----------------------------------------------------------------------
  28091. 602. uncaught exception UnboundTable using System.Env.describe
  28092. Submitter: Dave MacQueen
  28093. Date: 9/29/92
  28094. Version: 0.85
  28095. Severity: major
  28096. Problem: 
  28097.   Invoking System.Env.describe on topLevelEnv with structure symbol
  28098.   "System" yields uncaught exception UnboundTable
  28099. Transcript: 
  28100.   Standard ML of New Jersey, Version 0.85, July 17, 1992
  28101.   val it = () : unit
  28102.   - System.Env.describe (System.Env.staticPart (!System.Env.topLevelEnvRef))
  28103.      (System.Symbol.strSymbol "System");
  28104.   uncaught exception UnboundTable
  28105.   - 
  28106. Comment: System is in Pervasives, not topLevelEnv, but describe should
  28107.      catch the exception and give a report.
  28108. Status: fixed in 0.89 (Cregut)
  28109. ----------------------------------------------------------------------
  28110. 603. System.Symbol.makestring gives eroneous answer
  28111. Submitter:      cregut
  28112. Date:        7/29/92
  28113. Version:        .83 -> .86
  28114. System:         all
  28115. Severity:       minor
  28116. Problem:        System.Symbol.makestring gives eroneous answer
  28117. Code: 
  28118. Transcript:     
  28119. - open System.Symbol;
  28120. open Symbol
  28121. - makestring(sigSymbol "s");
  28122. val it = "TYC$s" : string
  28123. Comments:    bad order of namespaces
  28124. Fix:        change makestring in env.sml 
  28125. Test File:
  28126.  
  28127. let open System.Symbol 
  28128. in 
  28129. if (makestring(valSymbol "s")^makestring(tycSymbol "s")^
  28130.     makestring(sigSymbol "s")^makestring(strSymbol "s")^
  28131.     makestring(fctSymbol "s")^makestring(fixSymbol "s")) 
  28132.    = "VAL$sTYC$sSIG$sSTR$sFCT$sFIX$s"
  28133. then "System.Symbol.makestring seems O.K." 
  28134. else "Verify the behaviour of System.Symbol.makestring"
  28135. handle _ => "System.Symbol.makestring has a major bug"
  28136. end
  28137. Status: fixed in 0.87
  28138. ----------------------------------------------------------------------
  28139. 604. blast_read/blast_write broken
  28140. Submitter:      Emden R. Gansner erg@ulysses.att.com
  28141. Date:           30 July 1992
  28142. Version:        0.86
  28143. System:         Sparc 2, SunOS 4.1
  28144. Severity:       major
  28145. Problem:        blast_read/blast_write is broken
  28146. Code:           
  28147.   (* The following function writes a value, then reads it back in
  28148.    * and compares them. In 0.86, the values are not equal.
  28149.    * If one attempts to print v', the system hangs, causing a
  28150.    * core dump on interrupt.
  28151.    * You can replace 'int list' with your favorite eqtype
  28152.    *)
  28153. fun btest v = let
  28154.   val ofd = open_out "dump"
  28155.   val bwrite : outstream * int list -> int = System.Unsafe.blast_write
  28156.   val bread : instream * int -> int list = System.Unsafe.blast_read
  28157.   val sz = bwrite(ofd,v)
  28158.   val _ = close_out ofd
  28159.   val ifd = open_in "dump"
  28160.   val v' = bread(ifd,sz)
  28161.   in
  28162.     close_in ifd;
  28163.     if v = v' then print "v = v'\n" else print "print v <> v'\n"
  28164.   end
  28165. Transcript:
  28166.   Standard ML of New Jersey, Version 0.86, July 22, 1992
  28167.   val it = () : unit
  28168.   - use "btest.sml";
  28169.   val btest = fn : int list -> unit
  28170.   [closing btest.sml]
  28171.   val it = () : unit
  28172.   - btest [];
  28173.   
  28174.   [Major collection...abandoned]
  28175.   print v <> v'
  28176.   val it = () : unit
  28177.   - btest [1,2];
  28178.  
  28179.   [Major collection...abandoned]
  28180.   print v <> v'
  28181.   val it = () : unit
  28182.   - 
  28183. Comments: Does this have anything to do with bug 548 being fixed?
  28184. Fix: [Appel]
  28185.     at the beginning of ml_blast_out in cfuns.c, insert the following line
  28186.     after "blast_fd = REC_SEL..."
  28187.  
  28188.        msp->ml_arg = arg;
  28189.  
  28190.     Then do a makeml -noclean and things ought to work better.
  28191. Status: fixed in 0.87
  28192. ----------------------------------------------------------------------
  28193. 605. whose bug?
  28194. Submitter:      Charles Krasic
  28195.         cckrasic@plg.waterloo.edu
  28196. Date:        July 31, 1992
  28197. Version:        0.75
  28198. System:         Sparc, SunOS 4.1.2
  28199. Severity:       critical
  28200. Problem:        file compiles OK with batch compiler, but runtime/run
  28201.              fails with "uncaught exception (Loader): Syntax"
  28202. Comments:    I am working on the source code of NJSML itself.  I have made some
  28203.         fairly significant changes so it would be a non-trivial amount of
  28204.         work for me to give you all the code necessary to run NJSML and 
  28205.         reproduce my problem.   I have isolated my problem to 1 line of code
  28206.         in the source code which is will briefly summarize here.  The 
  28207.         file that contains the code in question is at the end of this message.
  28208.         This code is part of my modified type checker.  Roughly, it is
  28209.         called prior to the 0.75 typechecker (there are many changes...)
  28210.  
  28211.         This seems to be a very nasty bug to me. It should be noted that, while 
  28212.         I am changing the compiler, I am compiling my changed version with the 
  28213.         stock 0.75 version of the batch compiler.  My changes are confined
  28214.         entirely to the front end of the compiler (nothing after typechecking).
  28215.  
  28216.         Some of the things I tried:    
  28217.  
  28218.         The offending section of code is:
  28219.  
  28220. 1.        (case var of
  28221. 2.            (VALvar{constraints,...}) => 
  28222. 3.            (ConstraintsStack.push constraints;
  28223. 4.             constructList := (constraints :: (!constructList));
  28224. 5.             expType(env,exp,err,loc); 
  28225. 6.             ConstraintsStack.pop())
  28226. 7.          | _ => (ErrorMsg.impossible "MakeImplicitsPass.Pass2.valrecType"))
  28227.  
  28228.         If lines 3,4 and 6 are removed (and 5 has the semicolon removed), it
  28229.         will build OK.  Alternatively, if line 5 is removed, it also will
  28230.         build OK.  Of course, either of those things doesn't do what I want
  28231.         it to do.  I have tried many variations on the above code but could
  28232.         not get any to work.
  28233.  
  28234. Status: not a bug (bug was in his own code)
  28235. ----------------------------------------------------------------------
  28236. 606. Allocating space for saved FP registers is awkward
  28237. Submitter:      Mark Leone (mleone@cs.cmu.edu)
  28238. Date:        July 31, 1992
  28239. Version:        0.82
  28240. System:         i386
  28241. Severity:       Necessary change for i386 runtime
  28242. Problem:        Allocating space for saved FP registers is awkward
  28243. Code:           none
  28244. Transcript:    none
  28245. Comments:
  28246.    In runtime/signal.c, in make_ml_sigh_arg(), floating point registers
  28247.    are saved as follows:
  28248.  
  28249.    #if (NSAVED_FPREGS > 0)
  28250.        savefpregs (msp);
  28251.        fpregs = PTR_CtoML(msp->ml_allocptr + sizeof(long));
  28252.        msp->ml_allocptr += (NSAVED_FPREGS*2 + 1) * sizeof(long);
  28253.    #else
  28254.        ...
  28255.  
  28256.    This code assumes that savefpregs only needs NSAVED_FPREGS*2 + 1
  28257.    words.  This assumption fails on the 386, since the entire FP
  28258.    coprocessor state must be saved, not just the registers.  
  28259.  
  28260. Fix:        
  28261.    A better approach is for savefpregs() to update the allocptr itself
  28262.    and return a pointer to the saved state:
  28263.  
  28264.    #if (NSAVED_FPREGS > 0)
  28265.        fpregs = savefpregs (msp);
  28266.    #else
  28267.        ...
  28268. Comment: [jhr]
  28269.   A better fix might be introducing a machine dependent constant for the
  28270.   fp-save area size.  Also, savefpregs should probably get the save area
  28271.   pointer as its argument, since this would simplify the assembly code
  28272.   a bit.
  28273. Status: open
  28274. ----------------------------------------------------------------------
  28275. 607. weak typing
  28276. Submitter: John Greiner <John.Greiner@WAGOSH.FOX.CS.CMU.EDU>
  28277. Date: 8/4/92
  28278. Version: 0.86
  28279. Severity: major
  28280. Problem: 
  28281.   Weak typing error allows failure of type security.
  28282. Transcript: 
  28283.   - fn x => let val a = ref nil in
  28284.       (let val b = a in b := [true]; hd (!b) + 1; (fn z => z) end) () end;
  28285.   val it = fn : 'a -> unit
  28286. Fix: This can be fixed by replacing "absd-abs" by "max(0,absd-abs)" in
  28287.      basics/typesutil.sml.
  28288. Status: fixed in 0.89
  28289. ----------------------------------------------------------------------
  28290. 608. minor error in runtime
  28291. Submitter: David Tarditi
  28292. Date: 8/4/92
  28293. Version: 0.85
  28294. Severity: minor
  28295. Problem: 
  28296.   In version 0.85, line 114: run.c, there's a function call of
  28297.   the form:
  28298.       init_externlist(msp)
  28299.   but you'll see in cfuns.c that init_externlist takes no arguments.
  28300. Status: fixed in 0.89
  28301. ----------------------------------------------------------------------
  28302. 609. include syntax
  28303. Submitter: Larry Paulson <Larry.Paulson@cl.cam.ac.uk>
  28304. Date: 7/31/92
  28305. Version: 0.75
  28306. Severity: minor
  28307. Problem: 
  28308.   Standard ML of New Jersey, Version 75, seems to reject the syntax
  28309.  
  28310.      include SIGID1 ... SIGIDn
  28311.  
  28312.   (See the definition of Standard ML, page 13.)
  28313. Status: fixed in 0.90
  28314. ----------------------------------------------------------------------
  28315. 610. changeLvars broken
  28316. Submitter: Gene Rollins
  28317. Date: 8/5/92
  28318. Version: 0.87
  28319. Severity: major (for separate compilation)
  28320. Problem: 
  28321.   There is a compiler bug in SML/NJ 0.85 and 0.87 that is not present in 0.80.
  28322.   I tracked it down to this: the function changeLvars when applied to
  28323.   a staticUnit sometimes eliminates bindings to fixity symbols.  So, if you try
  28324.   to read a compiled binary file, and then compile a file that uses symbols
  28325.   defined in the binary file, you sometimes get an error such as this:
  28326.  
  28327.       a.sig:1.15-1.19 Error: FIRST undefined (parser)
  28328.  
  28329.   If the symbol is really undefined you also get this message:
  28330.       a.sig:1.15-1.19 Error: unbound signature: FIRST
  28331.  
  28332.   This happens on pmax_mach and sun4_mach machines.  I found that once you have
  28333.   a binary file that this bug happens with, it is repeatable.  But, not all
  28334.   binary files tickle this bug.
  28335. Transcript: 
  28336.   - System.system "cat first.sig";
  28337.   signature FIRST = sig val x:int end
  28338.  
  28339.   - val perv = !System.Env.pervasiveEnvRef;
  28340.   val perv = prim? : environment
  28341.  
  28342.   - val se = System.Env.staticPart perv;
  28343.   val se = prim? : staticEnv
  28344.  
  28345.   - val (staticUnit, codeUnit) = SepComp.compileSource ("first.sig", se);
  28346.   [closing first.sig]
  28347.   val staticUnit = {boundLvars=[],staticEnv=prim?} : System.Compile.staticUnit
  28348.   val codeUnit = prim? : codeUnit
  28349.  
  28350.   - val delta = System.Compile.execute ((staticUnit, codeUnit), perv);
  28351.   signature FIRST
  28352.   <other binding>
  28353.   val delta = prim? : environment
  28354.  
  28355.   - appSE (findName "FIRST") delta; (* catalogEnv; filter for symbols "FIRST" *)
  28356.   FIRST
  28357.      fixity information of a module component
  28358.   FIRST
  28359.      signature
  28360.   val it = () : unit
  28361.  
  28362.   - val staticUnit2 = System.Compile.changeLvars staticUnit;
  28363.   val staticUnit2 = {boundLvars=[],staticEnv=prim?} : System.Compile.staticUnit
  28364.  
  28365.   - val delta2 = System.Compile.execute ((staticUnit2, codeUnit), perv);
  28366.   signature FIRST
  28367.   val delta2 = prim? : environment
  28368.  
  28369.   - appSE (findName "FIRST") delta2;
  28370.   FIRST
  28371.      signature
  28372.   val it = () : unit
  28373.   -
  28374. Fix: adjust for new representation of fixity bindings?
  28375. Status: fixed in 0.91 (dbm)
  28376. ----------------------------------------------------------------------
  28377. 611. batch compiler doesn't like local structure declarations
  28378. Submitter:      Mark Leone (mleone@cs.cmu.edu)
  28379. Date:        August 5, 1992
  28380. Version:        0.82
  28381. System:         all
  28382. Severity:       very minor
  28383. Problem:        batch compiler doesn't like local structure declarations
  28384. Code:         
  28385.     (* From bug report #278 *)
  28386.     local
  28387.        structure Internal = struct val x=1 val y=2 end
  28388.     in
  28389.        structure First  : sig val x : int end = Internal
  28390.        structure Second : sig val y : int end = Internal
  28391.     end
  28392. Transcript:
  28393.     Standard ML of New Jersey, Version 82, June 1, 1992 (batch compiler)
  28394.     [Compiling tmp.sml]
  28395.     Error: signature, functor, or structure expected
  28396.     [closing tmp.sml]
  28397. Comments:
  28398.     This seems to be the same problem exhibited by the interactive
  28399.     top-level in bug report #278 (which has been fixed).
  28400. Status: open
  28401. ----------------------------------------------------------------------
  28402. 612. bad lambda depth calculated in type checker
  28403. Submitter:      Mark Lillbridge (mdl@cs.cmu.edu)
  28404. Date:        August 5, 1992
  28405. Version:        0.87
  28406. System:         Sparc
  28407. Severity:       major
  28408. Problem:        Lambda depth is miscalculated in some cases causing
  28409.         the compiler to core dump
  28410. Code:           
  28411.         fun id x = x;
  28412.  
  28413.         (fn y => id (let val u = y in u end)) 1 2;
  28414.  
  28415. Transcript:
  28416.         - fun id x = x;
  28417.         val id = fn : 'a -> 'a
  28418.         - (fn y => id (let val u = y in u end)) 1 2;
  28419.         Bus error (core dumped)
  28420.  
  28421. Comments:    The code in typesutil.sml that calculates lamdepth is
  28422.         wrong.  In cases like this, lamdepth can actually
  28423.         decrease instead of being monotonically increasing.
  28424.         (Here, lamdepth is 1 at the fn y => but 0 at the let.)
  28425.  
  28426. Status: fixed in 0.89
  28427. ----------------------------------------------------------------------
  28428. 613. Compiler bug message on occurence of typevar in signature
  28429. Submitter:      Kees van Schaik <kees@diku.dk>
  28430. Date:        August 7 1992
  28431. Version:        Version 75
  28432. System:         Sun 4 Sparc station running SunOS Release 4.1.1
  28433. Severity:       minor
  28434. Problem:        Compiler bug message on occurence of typevar in signature
  28435. Code:         
  28436.         signature BuggySignature = 
  28437.            sig exception IllegalException of '_a ref end
  28438.  
  28439. Transcript:    
  28440.         Standard ML of New Jersey, Version 75, November 11, 1991
  28441.         The Edinburgh SML Library Make is now pre-loaded.
  28442.         val it = () : unit
  28443.         - signature BuggySignature = 
  28444.              sig exception IllegalException of '_a ref end;
  28445.         signature BuggySignature = 
  28446.           sig
  28447.             exception IllegalException of Error: Compiler bug: domain
  28448.  
  28449. Comments:    The signature is not a legal one since it is not allowed to
  28450.         use type variables in exception declarations in signatures.
  28451.         A somewhat more informative way of telling that would be
  28452.         nice (mostly to people who did not know/realise that their
  28453.         code was not legal when triggering the bug, who will most
  28454.         probably the only ones triggering it), but the bug does not
  28455.         cause any serious problems.
  28456.  
  28457. Comments: [dbm] Now generates an error message when signature is elaborated.
  28458.  
  28459. Status: fixed in 0.91 (dbm)
  28460. ----------------------------------------------------------------------
  28461. 614. high-order-functor thinning-in
  28462. Submitter:    Zhong Shao   (zsh@cs.princeton.edu)
  28463. Date:         August 6, 1992
  28464. Version:      0.86
  28465. System:       mipsb/riscos
  28466. Severity:     critical
  28467. Problem:      high-order-functor thinning-in
  28468. Code:
  28469.               signature SIG = sig val e : real
  28470.                               end
  28471.  
  28472.               funsig PROD (structure M : SIG
  28473.                            structure N : SIG) = SIG
  28474.  
  28475.               structure S = struct val e = 100.0
  28476.                             end
  28477.  
  28478.               structure P = struct val e = 0.0
  28479.                             end
  28480.  
  28481.               functor Square(structure X : SIG
  28482.                              functor Prod : PROD) : SIG =
  28483.                   Prod(structure M = S
  28484.                        structure N = X)
  28485.  
  28486.               functor F(structure N : SIG) = struct val e = (N.e * N.e)
  28487.                                              end
  28488.  
  28489.               structure A = Square(structure X = P
  28490.                                    functor Prod = F);
  28491.  
  28492.               A.e;
  28493.  
  28494. Transcript:
  28495.               .....................
  28496.               - A.e;
  28497.               val it = 10000.0 : real
  28498.  
  28499. Comments:     A.e should be 0.0 instead. The problem is that
  28500.               when F is applied to (structure M=S structure N=P) in
  28501.               the body of functor Square, the argument is not thinned
  28502.               against the parameter signature of the functor F.
  28503.  
  28504. Status: fixed in 0.89
  28505. ----------------------------------------------------------------------
  28506. 615. System.Symbol.makestring has incomplete implementation
  28507. Submitter:      Andrew Tolmach (apt@research.att.com)
  28508. Date:        10 Aug 92
  28509. Version:        0.85 through 0.88
  28510. System:         mips riscos
  28511. Severity:       minor
  28512. Problem:        Can't apply System.Symbol.makestring to pervasive environment.
  28513. Code:           - let open System.Env System.Symbol 
  28514.           in map makestring (catalogEnv (staticPart(!pervasiveEnvRef)))
  28515.           end;
  28516. Transcript:     above code causes 
  28517.         Compiler bug: Symbol.makestring
  28518.     
  28519. Fix:  Add TABspace case to Env.symbolToString (?)
  28520. Status: fixed in 0.89
  28521. ----------------------------------------------------------------------
  28522. 616. overloading versus user-bound type variable
  28523. Submitter: Lars Birkedal <birkedal@diku.dk>
  28524. Date: 8/12/92
  28525. Version: 0.87 (and earlier)
  28526. Severity: minor
  28527. Problem: 
  28528.   I assume you resolve arithmetic overloading in NJSml by 
  28529.   binding the operators, such as +, to a generel type-scheme, such 
  28530.   as \forall 'a. 'a *'a -> 'a, where the type-variables are marked
  28531.   as overloaded, and then elaborates as usual with the exception
  28532.   that overloaded type variables are not allowed to be quantified. 
  28533.   (Some examples I've run indicates this.)
  28534.  
  28535.   The following example seems to indicate that you allow unification of
  28536.   overloaded type variables with explicit type variables and when
  28537.   unifying marks the explicit type variables as overloaded. This mark
  28538.   prohibits quantification of the explicit type variable at its scoping
  28539.   declaration, hence violating rule 17 in the Definition.  My question
  28540.   is --- why allow unification of overloaded typevariables with explict
  28541.   type variables at all?; since quantification is not allowed,
  28542.   overlaoding cannot be resolved this way (as in let val f = fn x => x +
  28543.   x in f 2 end, which elaborates), so the only other way is to unify the
  28544.   explicit type variable with int or real, which is not allowed, hence
  28545.   overloading cannot be resolved this way either. So what do you gain?
  28546.  
  28547. Transcript: 
  28548.   - let val f = fn (x: 'a) => x + x in f 2 end;
  28549.   std_in:1.5-1.31 Error: explicit type variable cannot be generalized at its scoping declaration: 
  28550.   'a
  28551.   std_in:1.29 Error: overloaded variable "+" cannot be resolved
  28552.  
  28553. Comment: [dbm]
  28554.   The type variables of the type scheme of an overloaded variable are
  28555.   "marked as overloaded" when an instance of the type scheme is created
  28556.   for a particular applied occurence of the variable.  This marking is
  28557.   accomplished by a book-keeping device -- each type metavariable
  28558.   substituted for a bound variable of the scheme is given a "depth" of
  28559.   zero.  The depth attribute is used to determine whether a metavariable
  28560.   can be generalized at a val binding, and a depth of zero will prevent
  28561.   these metavariables (or metavariables in types substituted for them)
  28562.   from ever being generalized.
  28563.  
  28564.   When one of these metavariables is unified with a "user-bound" type
  28565.   variable like the 'a in your example, the depth of the metavariable is
  28566.   propagated to the user-bound variable, which in this case prevents the
  28567.   user-bound variable from being generalized at the appropriate place.
  28568.   This looks like a bug -- in fact, I think that the user-bound variable
  28569.   should probably not have a depth attribute at all.
  28570.  
  28571. Status: not a bug (but alternate handling might be better)
  28572. ----------------------------------------------------------------------
  28573. 617. interpreter fails with "no default in interp"
  28574. Submitter:      Andrew Tolmach (apt@research.att.com)
  28575. Date:        12 Aug 92
  28576. Version:        0.87
  28577. System:         mips riscos
  28578. Severity:       major
  28579. Problem:        On a variety of programs, the interpreter 
  28580.         fails with "no default in interp". 
  28581. Code:        System.Control.interp := true;
  28582.         use "/usr/local/sml/benchmarks/leroy.sml";
  28583.             (* the standard knuth-bendix benchmark *)
  28584.  
  28585. Transcript:   
  28586.  
  28587. signature KB = 
  28588.   sig
  28589.     datatype ordering
  28590.       con Equal : ordering
  28591.       con Greater : ordering
  28592.       con NotGE : ordering
  28593.     datatype term
  28594.       con Term : string * term list -> term
  28595.       con Var : int -> term
  28596.     val doit : unit -> unit
  28597.     val kb_complete : (term * term -> bool) -> (int * (int * (term * term))) list -> ('a * ('b * (term * term))) list -> unit
  28598.     val lex_ext : (term * term -> ordering) -> term * term -> ordering
  28599.     val rpo : (string -> string -> ordering) -> ((term * term -> ordering) -> term * term -> ordering) -> term * term -> ordering
  28600.   end
  28601. /usr/local/sml/benchmarks/leroy.sml:603.1-608.22 Warning: match not exhaustive
  28602.         "U" => ...
  28603.         "*" => ...
  28604.         "I" => ...
  28605.         "B" => ...
  28606.         "C" => ...
  28607.         "A" => ...
  28608. Error: Compiler bug: no default in interp
  28609. [closing /usr/local/sml/benchmarks/leroy.sml]
  28610. Comments: Failure to track changes in data representations?
  28611.   
  28612. If the debugger is built using makeml -i, this bug occurs
  28613. the first time a usedbg_live is tried.
  28614.  
  28615. Status: fixed in 0.90
  28616. ----------------------------------------------------------------------
  28617. 618. LOOKUP FAILS, Compiler bug: 110 in CPSgen
  28618. Submitter: Dave MacQueen
  28619. Date: 8/15/92
  28620. Version: 0.87
  28621. System: Sparc, Mips
  28622. Severity: critical
  28623. Code: 
  28624.   (* bug618.sml *)
  28625.  
  28626.   signature S0 =
  28627.   sig
  28628.     exception Error of string  (* string arg necessary *)
  28629.   end
  28630.  
  28631.   functor F (X : S0) =
  28632.   struct
  28633.     open X
  28634.     fun extend_one (i,v,r) j = if i = j then v else (r j) (* necessary *)
  28635.     fun extend_env _ = raise Error "foo"
  28636.   end
  28637.  
  28638.   structure A : S0 =
  28639.   struct
  28640.     exception Error of string
  28641.   end
  28642.  
  28643.   structure B = F(A)
  28644. Transcript: 
  28645.   skye$ sml
  28646.   Standard ML of New Jersey, Version 0.87, July 31, 1992
  28647.   val it = () : unit
  28648.   - use "bug618.sml";
  28649.   LOOKUP FAILS in close(FIX 2373
  28650.   ) on 2310
  28651.   in environment:
  28652.   2370 2368 2451 2448 2449 2450 
  28653.   2369/callee 2451 - 2448 2449 2450
  28654.   Error: Compiler bug: 110 in CPSgen
  28655.   [closing bug618.sml]
  28656.   - use "bug618.sml";
  28657.   Illegal instruction(coredump)
  28658.   skye$ 
  28659. Status: fixed in 0.89
  28660. ----------------------------------------------------------------------
  28661. 619. Compiler bug: Escapemap on xxxx
  28662. Submitter: Dave MacQueen
  28663. Date: 8/15/92
  28664. Version: 0.87
  28665. System: Sparc, Mips
  28666. Severity: critical
  28667. Code: 
  28668.   (* bug619.sml *)
  28669.  
  28670.   signature SIG =
  28671.   sig
  28672.     exception Error of string
  28673.   end
  28674.  
  28675.   functor F (X : SIG) =
  28676.   struct
  28677.     open X
  28678.  
  28679.     datatype Exp = APP of Exp * (Exp list)
  28680.     datatype Val = FUNC of Val list -> (Val -> unit) -> unit
  28681.  
  28682.     fun extend_one (i,v,r) j = if i = j then v else (r j)
  28683.     fun extend_env([],[],r) = r
  28684.       | extend_env(i::is,v::vs,r) = extend_env(is,vs,extend_one(i,v,r))
  28685.       | extend_env _ = raise Error "mismatching environment extension"
  28686.  
  28687.     fun  meaning (APP(e,es)) r k =
  28688.       meaning e r (fn (FUNC f) => meaninglis es r (fn vs => f vs k))
  28689.  
  28690.     and meaninglis [] r k = k []
  28691.       | meaninglis (e :: es) r k =
  28692.       meaning e r (fn v => meaninglis es r (fn vs => k (v :: vs)))
  28693.   end
  28694.  
  28695.   structure A : SIG =
  28696.   struct
  28697.     exception Error of string
  28698.   end
  28699.  
  28700.   structure B = F(A)  (* necessary *)
  28701. Transcript: 
  28702.   - skye$ sml
  28703.   Standard ML of New Jersey, Version 0.87, July 31, 1992
  28704.   val it = () : unit
  28705.   - use "bug619.sml";
  28706.   Error: Compiler bug: Escapemap on 2423
  28707.   [closing bug619.sml]
  28708.   - 
  28709. Comment: probably closely related to bug 618.  Minor simplifications
  28710.      of the code produce a version of bug 618.
  28711. Status: fixed in 0.89
  28712. ----------------------------------------------------------------------
  28713. 620. higher-order functor causes Compiler bug
  28714. Submitter: Dave MacQueen
  28715. Date: 8/15/92
  28716. Version: 0.87
  28717. Severity: major
  28718. Problem: 
  28719.   Higher order functor definition fails with
  28720.   "Compiler bug: abstractfct:tyconSeries1: param tycon not found"
  28721. Code: 
  28722.   signature SIG =
  28723.   sig
  28724.     datatype d = D of unit   (* the "of unit" is necessary for bug *)
  28725.   end
  28726.  
  28727.   functor Twice(functor F(A:SIG):SIG) =
  28728.   struct
  28729.     functor TwiceF(A: SIG) = F(F(A))
  28730.   end
  28731. Transcript: 
  28732.   - use "bug620.sml";
  28733.   Error: Compiler bug: abstractfct:tyconSeries1: param tycon not found
  28734.   [closing bug620.sml]
  28735. Status: fixed in 0.89
  28736. ----------------------------------------------------------------------
  28737. 621. polymorphic equality not eliminated as often as it should be
  28738. Submitter:   aitken@cs.cornell.edu (William E. Aitken)
  28739. Date:        Aug 13, 1992
  28740. Version:     0.87 (also 0.88b)
  28741. System:      sun4 sunos 
  28742. Severity:    minor
  28743. Problem:     polymorphic equality not eliminated as often as it should be
  28744. Code:        
  28745.          val eq = (op =)
  28746.          val eq1 : int * int -> bool = (op =)
  28747.          val eq2 = (op =) : int * int -> bool
  28748.          
  28749. Transcript: 
  28750. (Script started on Thu Aug 13 11:46:13 1992)
  28751. ai $ sml
  28752. Standard ML of New Jersey, Version 0.87, July 31, 1992
  28753. val it = () : unit
  28754. - System.Control.CG.printit := true;
  28755. val it = () : unit
  28756. - (* this should be implemented as poly-eq *)
  28757. = val eq  = op =;
  28758.  
  28759. After convert:
  28760. 2316(2314,2315) =
  28761.    2317(2313,2318) =
  28762.       2319(2320) =
  28763.          2318((I)0)
  28764.       2313((I)99,2319)
  28765.    2317(2314,2315)
  28766. .
  28767. .
  28768. .
  28769. val eq = - : ''a * ''a -> bool
  28770.  
  28771. - (* this should be implemented as integer equality, but isn't *)
  28772. = val eq1 : int * int -> bool = (op =) ;
  28773.  
  28774. After convert:
  28775. 2346(2344,2345) =
  28776.    2347(2343,2348) =
  28777.       2349(2350) =
  28778.          2348((I)0)
  28779.       2343((I)99,2349)
  28780.    2347(2344,2345)
  28781. .
  28782. .
  28783. .
  28784. val eq1 = - : int * int -> bool
  28785. -
  28786. - (* this should be implemented as integer equality, and is *)
  28787. = val eq2 = (op =) : int * int -> bool;
  28788.  
  28789. After convert:
  28790. 2376(2374,2375) =
  28791.    2377(2373,2378) =
  28792.       2379(2380) =
  28793.          2382(2381,2383) =
  28794.             2381.0 -> 2384
  28795.             2381.1 -> 2385
  28796.             if ieql(2384,2385) [2388] then
  28797.                2383((I)1)
  28798.             else
  28799.                2383((I)0)
  28800.          {2382} -> 2389
  28801.          2378(2389)
  28802.       2373((I)99,2379)
  28803.    2377(2374,2375)
  28804.  
  28805. .
  28806. .
  28807. .
  28808.  
  28809. val eq2 = fn : int * int -> bool
  28810.  
  28811. (script done on Thu Aug 13 11:47:39 1992)
  28812.  
  28813. Comments:
  28814.  
  28815. eq1 implements the equality check as a call to
  28816. polymorphic equality, while eq2 
  28817. inline expands the equality for the type int.
  28818.  
  28819. This is particularly obnoxious since, at least to me, 
  28820. the declaration of eq1 looks prettier.
  28821.  
  28822. Status: fixed in 0.89
  28823. ----------------------------------------------------------------------
  28824. 622. Bus error on DECstation 5000/200
  28825. Submitter: Urban Engberg <urban@daimi.aau.dk>
  28826. Date: 8/18/92
  28827. Version: 0.75-0.80
  28828. System: DECstation 5000/200 and 5000/240
  28829. Severity: major
  28830. Problem: 
  28831.   I have been using SML of NJ for a couple of years, mostly for writing
  28832.   compiler-related tools.  The tool I am currently working on contains about 7000
  28833.   lines of sml-code, including the code produced by sml-lex and -yacc.  The
  28834.   relatively large size of the program seems essential to my problem to be
  28835.   described.
  28836.  
  28837.   When compiling the code, by reading in the files with "use", the sml system
  28838.   once in a while crashes with messages such as
  28839.  
  28840.     pid 22613 (tlac.orig) was killed on an unaligned access, at pc 0x100a3550
  28841.     Bus error (core dumped)
  28842.  
  28843.   The problem has been specific to running on DECstations 5000/200 and 5000/240
  28844.   (at least) but occurs on all the machines of this kind that I have tried.
  28845.  
  28846.   I have been able to bear over with the problems for some time, without trying
  28847.   to find the error, as I would just have to restart the compilation at the right
  28848.   point a couple of times.
  28849.  
  28850.   Lately, however, the problem has started showing up more and more often when I
  28851.   execute the binary image I create with the library-construct "exportFn".  As my
  28852.   code has been growing, I have now got a ratio of well-functioning runs to ones
  28853.   crashing of about 1:10!  Thus it is beginning to be a very big problem.
  28854.  
  28855.   [added 8/19/92]
  28856.   The problem occurs at random.  But running a compilation which takes about five
  28857.   seconds will currently produce the crash nine times out of ten.
  28858.  
  28859.   I am running Ultrix version 4.2A (Apr 92), which I suppose is one of the
  28860.   newest.  I remember having had problems all the time since I began using DEC
  28861.   machines though, since March 91.  You are quite right in that `unaligned
  28862.   access' errors seems to indicate some sort of Ultrix bug.
  28863. Comments: [George]
  28864.   This brings back memories of when I was bringing up the new MIPS
  28865.   code generator. The regression tester specifically, would run
  28866.   just fine on a MIPSEB but would crash once in a while in a 
  28867.   non-deterministic manner on a MIPSEL. The error message was 
  28868.   identical - unaligned access, at pc ...
  28869.  
  28870.   At the time, we concluded that this was an operating system related 
  28871.   problem, and not the fault of the generated code. Unfortunately, I 
  28872.   did not persist in getting to the root of the problem. I am not 
  28873.   able to reproduce the error as the regression tester being used
  28874.   is gone!!
  28875.  
  28876.   My suggestion would be to try a post v 0.82 release that had
  28877.   even less reliance on the operating system - i.e., any trapless gc
  28878.   version.
  28879.  
  28880. Followup: [Urban Engberg, 8/24/92]
  28881.   It has been making me curious that the errors lately doesn't seem to show up in
  28882.   other programs than my compiler (where it with earlier sml versions has been a
  28883.   problem with many programs, and also when compiling the compiler).  So with a
  28884.   good guess, I tried removing some calls I had to `IO.execute'.  This made a
  28885.   crucial difference; the compiler now runs without any problems.
  28886.  
  28887.   To help finding the error, it should be noted that the compiler works fine
  28888.   *with* the `IO.execute' commands, when run from within an interactive sml
  28889.   session.
  28890.  
  28891.   I have tried to reproduce the error in a smaller program, but without success.
  28892.  
  28893.   The calls to `IO.execute' looked as follows:
  28894.  
  28895.       val (datestream, dummy) =
  28896.               IO.execute ("/bin/csh", ["-cfb", 
  28897.                   "/bin/date +\"%a %h %d%H:%M 19%y\""])
  28898.       val date = input (datestream, 21) before (close_in datestream;
  28899.                             close_out dummy)
  28900. Status: fixed in 0.89
  28901. ----------------------------------------------------------------------
  28902. 623. wildcard is equivalent to a serie of wildcards (see also 629)
  28903. Submitter:      cregut 
  28904. Date:        20/8/92
  28905. Version:        .88
  28906. System:         all
  28907. Severity:       minor/major
  28908. Problem:        wildcard is equivalent to a serie of wildcards
  28909. Code:
  28910.   fun foo x 0 = x | foo _ = 0;  (* this failed in pre-0.88 versions *)
  28911. Transcript:
  28912.   val foo = fn : int -> int -> int
  28913. Status: fixed in 0.90
  28914. ----------------------------------------------------------------------
  28915. 624. System.Env.filterEnv causes Compiler bug: copystat.
  28916. Submitter: Gene Rollins
  28917. Date: 8/21/92
  28918. Version: 0.88
  28919. Severity: major
  28920. Problem: 
  28921.   System.Env.filterEnv causes compiler bug: copystat.
  28922. Code: 
  28923. ==== env.sml ====
  28924. structure TestEnv = struct
  28925.  fun printEnv (e:System.Env.environment) =
  28926.    app (fn s=> (print ((System.Symbol.makestring s) ^ "\n")))
  28927.      (System.Env.catalogEnv (System.Env.staticPart e))
  28928.  val TestStructure = System.Symbol.strSymbol "Test";
  28929.  fun test() =
  28930.    (use "test.sml";
  28931.     printEnv (!System.Env.topLevelEnvRef); print "----------\n";
  28932.     printEnv(System.Env.filterEnv(!System.Env.topLevelEnvRef,[TestStructure])))
  28933. end
  28934. ==== test.sml ====
  28935. structure Test = struct val x = 4 end
  28936. Transcript: 
  28937. Standard ML of New Jersey, Version 0.88, August 14, 1992
  28938. - use "env.sml";
  28939. structure TestEnv : sig
  28940.     val TestStructure : symbol
  28941.     val printEnv : environment -> unit
  28942.     val test : unit -> unit
  28943.   end
  28944. - TestEnv.test();
  28945. structure Test : sig val x : int end
  28946. [closing test.sml]
  28947. STRTAB$Test
  28948. STRTAB$TestEnv
  28949. STR$Test
  28950. STR$TestEnv
  28951. VAL$it
  28952. ----------
  28953. Error: Compiler bug: copystat
  28954.  
  28955. Status: fixed in 0.89 (Cregut)
  28956. ----------------------------------------------------------------------
  28957. 625. Runbind exception still being raised.
  28958. Submitter: Gene Rollins, Andrew Appel
  28959. Date: 8/21/92
  28960. Version: 0.88
  28961. Severity: major
  28962. Problem: Runbind exception still being raised.
  28963. Status: fixed in 0.91 (not verified)
  28964. ----------------------------------------------------------------------
  28965. 626. extra spaces in SPARC.prim.s
  28966. Submitter: Gene Rollins
  28967. Date: 8/21/92
  28968. Version: 0.88
  28969. System: SPARC
  28970. Severity: 
  28971. Problem: 
  28972. It appears that our assembler can't handle the extra spaces given in several
  28973. of the #defines in the original file SPARC.prim.s.0.  The new SPARC.prim.s
  28974. works fine.  Here are the differences.  They are all within the first 55 lines.
  28975. Fix:
  28976. % diff SPARC.prim.s.0 SPARC.prim.s
  28977. 26c26
  28978. < #define exncont  g7  /* exception handler (ml_exncont)    */
  28979. ---
  28980. > #define exncont g7   /* exception handler (ml_exncont)    */
  28981. 29,35c29,35
  28982. < #define limit    g4  /* heap limit pointer (ml_limitptr)*/
  28983. < #define stdarg   i0  /* standard argument (ml_arg)      */
  28984. < #define stdcont  i1  /* standard continuation (ml_cont) */
  28985. < #define stdclos  i2  /* standard closure  (ml_clos)    */
  28986. < #define baseptr  i3  /* base code pointer (ml_roots[])  */
  28987. < #define varptr   i5  /* var pointer       (ml_varptr)   */
  28988. < #define stdlink  g1  
  28989. ---
  28990. > #define limit g4     /* heap limit pointer (ml_limitptr)*/
  28991. > #define stdarg i0    /* standard argument (ml_arg)      */
  28992. > #define stdcont i1   /* standard continuation (ml_cont) */
  28993. > #define stdclos i2   /* standard closure  (ml_clos)    */
  28994. > #define baseptr i3   /* base code pointer (ml_roots[])  */
  28995. > #define varptr i5    /* var pointer       (ml_varptr)   */
  28996. > #define stdlink g1  
  28997. 49,53c49,53
  28998. < #define tmp1  o2
  28999. < #define tmp2  o3
  29000. < #define tmp3  o4
  29001. < #define tmp4  o5  /* also used to pass register mask to g.c. */
  29002. < #define gclink  o7   /* link register for return from g.c.  (ml_pc) */
  29003. ---
  29004. > #define tmp1 o2
  29005. > #define tmp2 o3
  29006. > #define tmp3 o4
  29007. > #define tmp4 o5     /* also used to pass register mask to g.c. */
  29008. > #define gclink o7   /* link register for return from g.c.  (ml_pc) */
  29009. Status: Fixed in 0.89
  29010. ----------------------------------------------------------------------
  29011. 627. blast-writing objects outside the heap leads to failure
  29012. Submitter: David Tarditi
  29013. Date: 8/21/92
  29014. Version: 0.88
  29015. Severity: major
  29016. Problem: 
  29017.   blast-write fails when given an object that is outside the
  29018.   heap.   The following program (for version 0.75, shareable) demonstrates this.
  29019.   You'll have to change the program slightly to run it in the latest version of
  29020.   the compiler, since the type of blast_read has changed.
  29021. Code: 
  29022.   structure blast =
  29023.       struct
  29024.       val s = System.version
  29025.       val outblast = fn () =>
  29026.         let val outfd = open_out "testblast"
  29027.          in (System.Unsafe.blast_write (outfd, s); close_out outfd)
  29028.         end
  29029.       val inblast = fn () =>
  29030.         let val infd = open_in "testblast"
  29031.         val res : string = System.Unsafe.blast_read infd
  29032.         val _ = close_in infd
  29033.         in
  29034.           (print "Got back: "; print res; print " : from testblast\n")
  29035.         end
  29036.  
  29037.       val _ = outblast ()
  29038.       val _ = inblast ()
  29039.   end
  29040. Transcript: 
  29041.   - use "/usr/dtarditi/tmp";
  29042.   [opening /usr/dtarditi/tmp]
  29043.  
  29044.   [Major collection...abandoned]
  29045.   Got back:  : from testblast
  29046.   structure blast : 
  29047.     sig
  29048.       val inblast : unit -> unit
  29049.       val outblast : unit -> unit
  29050.       val s : string
  29051.     end
  29052.   [closing /usr/dtarditi/tmp]
  29053.   val it = () : unit
  29054. Comments:
  29055.   In the shareable version of the compiler, where the code for the compiler
  29056.   is palced outside the heap, the string System.version ends up outside the
  29057.   heap.
  29058. Fix:
  29059.   The solution is to add a check to the code for blast-write, I think,
  29060.   for the case where the object being blasted out is a pointer that is outside
  29061.   the heap.
  29062.   [Tarditi, 8/21/92:]
  29063.   I remember there was some problem about import not working across 
  29064.   different compiled versions of the same compiler.  For example,
  29065.   I think import files created with a shareable version of the compiler
  29066.   caused the nonshared version to crash.   I've realized what the problem
  29067.   is, and it is worth noting down for future reference.
  29068.  
  29069.   The basic problem is that blast_write isn't fully generally, and only
  29070.   works with a particular executable.  If you blast-write an object which
  29071.   contains pointers that are outside the heap, the garbage collector
  29072.   just copies the pointers as though they were integers.   The problem is
  29073.   that with different executables, the objects outside the heap may not
  29074.   exist at all, may be different (that is, the pointer points to junk), or
  29075.   they may be at a different address.
  29076.  
  29077.   Think about what happens when you blast-write a function.   The function
  29078.   will most likely contain objects from the pervasive environment in its
  29079.   closure.  Suppose one of those objects from the pervasive environment
  29080.   is a closure.  It will contain a code pointer.  If the compiler is 
  29081.   shareable version, the code pointer will be outside the heap.  Now,
  29082.   if we try to read blast_read this function into a nonshareable version
  29083.   of the compiler, the code pointer will be junk!  
  29084.  
  29085.   Note that you'll have this problem even if only the runtime has been
  29086.   changed across executables.  This will change the address of code for
  29087.   the assembly language primitives, and the addresses of ML objects allocated
  29088.   as static C data structures.
  29089.  
  29090.   A possible solution to add a level of indirection between objects in the
  29091.   runtime system and blast-written objects.
  29092.  
  29093.   (1) give every possible ML object in the runtime system a unique name
  29094.   (2) when blast-writing an object, translate ML objects outside the heap to
  29095.       their unique names
  29096.   (3) when blast-reading an object, translate from the unique names back to the
  29097.       ML objects.
  29098.  
  29099.   We could hack something up to deal with the code strings for the pervasives
  29100.   being either in the heap or text segment.
  29101.  
  29102.   We'd have to put a limitation that you can only blast-read/blast-write objects
  29103.   outside the heap which are "registered" (i.e. you can't blast-write things
  29104.   like the code for the compiler).   At least things could fail gracefully
  29105.   instead of crashing.
  29106.  
  29107. Status: fixed in 0.89
  29108. ----------------------------------------------------------------------
  29109. 628. System.Env.filterEnv broken (accidental duplicate of 624)
  29110. ----------------------------------------------------------------------
  29111. 629. fun declaration syntax  (see 623)
  29112. Submitter:      aitken@cs.cornell.edu (William E. Aitken)
  29113. Date:        Sat Aug 29 1992
  29114. Version:        0.88 (back to 0.83 -- worked in 0.82)
  29115. System:         Sun 4m/670 MP Sparc, SunOS Release 4.1.2
  29116. Severity:       minor
  29117. Problem:        function declarations made using `fun' may
  29118.         arbitrarily mix clauses in which the 
  29119.         formal parameters are curried and 
  29120.         clauses in which they are uncurried.  
  29121.         Note that if they are uncurried, the formal
  29122.         pattern must be of n-tuple type.  That is,
  29123.         it may be a variable pattern or a wildcard pattern
  29124.         or a tuple pattern of the appropriate arity.
  29125.  
  29126. Code:           
  29127.         fun foo 1 x = 17
  29128.                   | foo (a, b) = a + b
  29129.         
  29130.         fun bar (1, x) = 17
  29131.           | bar a b = a - b
  29132.  
  29133.         fun splat a b = 4
  29134.           | splat x = 5
  29135.  
  29136. Transcript: 
  29137.     
  29138. % sml
  29139. Standard ML of New Jersey, Version 0.88, August 14, 1992
  29140. val it = () : unit
  29141. - fun foo 1 x = 17
  29142. =   | foo (a, b) = a + b;
  29143. val foo = fn : int -> int -> int
  29144. - fun bar (1, x) = 17
  29145. =   | bar a b = a - b;
  29146. val bar = fn : int * int -> int
  29147. - fun splat a b = 4
  29148. =   | splat x = 5;
  29149. std_in:5.17-6.15 Warning: redundant patterns in match
  29150.         (a,b) => ...
  29151.         x => ...
  29152. val splat = fn : 'a -> 'b -> int
  29153. - ^D
  29154.  
  29155. Comments:
  29156.  
  29157.     There are two function declarations in
  29158.     translate/tempexpn.sml that (accidentally)
  29159.     exploit this bug.  They are the last two functions of
  29160.     the structure.  In the first case, the second argument needs
  29161.     to be uncurried, in the second case, the final clause
  29162.     needs a second wildcard pattern.  Similarly,
  29163.     the function labBranchOff in mips/mipsinstr.sml, needs
  29164.         a second wildcard pattern in its final clause's formal parameters.
  29165.  
  29166.     The problem occurs because no explicit test is ever made 
  29167.     to ensure that clauses have the same number of argument 
  29168.     patterns.  In elaborating a function declaration,
  29169.     the compiler produces something of the form
  29170.  
  29171.         fn x1 => ... => fn xn => case (x1, ..., xn) of
  29172.             p1 => e1
  29173.             .
  29174.             .
  29175.             .
  29176.             pm => em
  29177.  
  29178.     x1, ..., xn are distinct new variables.
  29179.     ei is the expression of the ith clause.
  29180.     n is the number of patterns in the *first* clause
  29181.     If the ith clause has r > 1 patterns (pi1, ..., pir), pi is the 
  29182.     the pattern (pi1, ..., pir).   If the ith clause has only
  29183.     one pattern, pi is that pattern.
  29184.  
  29185.     The type checker will detect most mis-matches between
  29186.     numbers of arguments --- e.g.,
  29187.  
  29188.         fun foo a b c = 4 
  29189.           | foo a b = 5;
  29190.         std_in:7.17-7.31 Error: rules don't agree (tycon mismatch)
  29191.             expected: 'Z * 'Y * 'X -> int
  29192.             found:    'W * 'V -> int
  29193.             rule:
  29194.                 (a,b) => 5
  29195.  
  29196.     but will not catch mis-matches between appropriately typed single 
  29197.     patterns and multiple patterns.      
  29198.     
  29199. Fix:    Add a check that the number of formal parameters agrees in  
  29200.     each clause.  Rewriting checkFB in parse/astutils.sml as 
  29201.     follows should work, the compiler compiles itself to a fixpoint
  29202.     with it installed, but I have *not* tested the resulting code
  29203.     very thoroughly.   (Note that translate/tempexpn.sml and 
  29204.     mips/mipsinstr.sml need to be fixed too, as described above).
  29205.  
  29206.     fun checkFB(clauses as ({name,pats,...}:rawclause)::rest, err) = 
  29207.           let 
  29208.             val patslen = length pats
  29209.                 in 
  29210.         if exists (fn {name=n,...} => not(Symbol.eq(n,name))) rest
  29211.                     then err COMPLAIN "clauses don't all have same function-name"
  29212.                   else if exists (fn {pats=p,...} => length p <> patslen) rest
  29213.                   then 
  29214.           err COMPLAIN "clauses don't all have same number of patterns"
  29215.             else ();
  29216.             clauses
  29217.           end
  29218.         | checkFB _ = ErrorMsg.impossible "CoreLang.checkFB"
  29219.  
  29220.     if calculating the length is too expensive here, 
  29221.     using the function
  29222.  
  29223.     fun len1 [x] = true | len1 _ = false
  29224.  
  29225.     will suffice, at the expense of less good error reporting.
  29226. Status: same as 623
  29227. ----------------------------------------------------------------------
  29228. 630. smallest number literal in patterns (same as 507)
  29229. Submitter:      aitken@cs.cornell.edu (William E. Aitken)
  29230. Date:        Sat Aug 29 1992
  29231. Version:        0.88
  29232. System:         Sun 4m/670 MP Sparc, SunOS Release 4.1.2
  29233. Severity:       minor
  29234. Problem:        the special constant denoting the smallest 
  29235.         member of the type int (~1073741824) causes
  29236.         compilation failure if it appears in patterns. 
  29237.         It is legal in expressions.
  29238.  
  29239. Code:           
  29240.          fun foo ~1073741824 = 5 
  29241.                | foo x = 3
  29242.  
  29243. Transcript: 
  29244.     
  29245. % sml
  29246. Standard ML of New Jersey, Version 0.88, August 14, 1992
  29247. val it = () : unit
  29248. - ~1073741824;
  29249. val it = ~1073741824 : int
  29250. - fun foo ~1073741824 = 5 | foo x = 3;
  29251. Error: Compiler bug: Overflow in cps/generic.sml
  29252. - ~1073741824;
  29253. val it =
  29254. uncaught exception Boxity
  29255. - ~1073741824;
  29256. val it = ~1073741824 : int
  29257. 1073741824;
  29258. std_in:2.1-2.10 Error: integer too large
  29259. - ^D
  29260.  
  29261. Comments:     If I've already submitted this bug, sorry.
  29262.     
  29263. Status: open
  29264. ----------------------------------------------------------------------
  29265. 631. PrintVal can't print a value of the Ast type
  29266. Submitter:      cregut
  29267. Date:        8/29/92
  29268. Version:        from .86
  29269. System:         sparc mips..
  29270. Severity:       
  29271. Problem:        PrintVal can't print a value of the Ast type
  29272. Code:
  29273. (* int.sml *)
  29274. structure interface = struct
  29275.   local
  29276.     open System.Compile System.Env
  29277.   in
  29278.   fun ast name =
  29279.      let val f = open_in name
  29280.          val source = makeSource (name,0,f,false,std_out)
  29281.          val (ast : System.Ast.dec,_) =
  29282.            parse(source,staticPart (!pervasiveEnvRef))
  29283.      in ast end
  29284.   end
  29285. end
  29286.  
  29287. Transcript:
  29288.  
  29289. - use "int.sml";
  29290. structure interface :
  29291.   sig
  29292.     val ast : string -> System.Ast.dec
  29293.   end
  29294. [closing int.sml]
  29295. val it = () : unit
  29296. - interface.ast "int.sml";
  29297. val it = SeqDec [MarkDec (Error: Compiler bug: PrintVal.switch: none of the data
  29298. cons matched
  29299. -
  29300.  
  29301. Comments: The AST type is built in parse/ast.sml but another version is
  29302. in system.sig and perv.sml so that the user can access it.
  29303. It is not a problem of consistency of defs (no changes with 85).
  29304. Fix: make sure ast.sml is compiled with newconreps having the
  29305. same value that will be default for the user.  That is, 
  29306. put "^newconreps !ast.sml ^newconreps" in the "all" file.
  29307. Status: fixed in 0.89
  29308. ----------------------------------------------------------------------
  29309. 632. minimal or maximal integer literals in patterns cause compiler bug
  29310. Submitter:      aitken@cs.cornell.edu (William E. Aitken)
  29311. Date:           August 30, 1992
  29312. Version:        0.88, also 0.75
  29313. System:         SunOS Release 4.1.2, Sun 4m/670 MP Sparc
  29314. Severity:       major
  29315. Problem:        Integer patterns larger than 2^29-1 or
  29316.             smaller than ~2^29 trigger a compiler bug.
  29317. Code:           
  29318.         fun foo 0x20000000 = true | foo x = false;
  29319.  
  29320. Transcript:     Standard ML of New Jersey, Version 0.88, August 14, 1992
  29321.         val it = () : unit
  29322.         - fun foo 0x20000000 = 5 ;
  29323.         std_in:2.1-2.22 Warning: match not exhaustive
  29324.             536870912 => ...
  29325.         Error: Compiler bug: Overflow in cps/generic.sml
  29326.         - 12;
  29327.         val it = 
  29328.         uncaught exception Boxity
  29329.         - fun foo  ~0x20000000 = 5 ;
  29330.         std_in:0.0-0.0 Warning: match not exhaustive
  29331.                 ~536870912 => ...
  29332.         val foo = fn : int -> int
  29333.         - fun foo ~0x20000001 = 5; 
  29334.         std_in:2.1-2.23 Warning: match not exhaustive
  29335.                 ~536870913 => ...
  29336.         Error: Compiler bug: Overflow in cps/generic.sml
  29337.         - 
  29338.  
  29339. Comments:    This is just a generalization of a bug reported 
  29340.         yesterday.
  29341. Status: same as 507
  29342. ----------------------------------------------------------------------
  29343. 633. space leak
  29344. Submitter: John Reppy
  29345. Date: 1/9/92
  29346. Version: 0.88
  29347. Severity: major
  29348. Problem: 
  29349. The old space leak in capture/escape seems to have reappeared.
  29350. I ran my test on versions 0.75-0.88, and here is a summary of
  29351. the results:
  29352.  
  29353.   version    space leak?
  29354.     75        no
  29355.     76        no
  29356.     77        yes
  29357.     78        yes
  29358.     79        yes
  29359.     80        yes
  29360.     81        no
  29361.     82        no
  29362.     83        no
  29363.     84        yes
  29364.     85        yes
  29365.     86        yes
  29366.     87        yes
  29367.     88        yes
  29368.  
  29369. Note that the two rounds of contract before eta were eliminated in
  29370. version 0.84.
  29371.  
  29372. As a reminder, the simple example of this problem is the function
  29373. select.
  29374.  
  29375. Code: 
  29376.   local
  29377.     open System.Unsafe.PolyCont
  29378.   in
  29379.     fun select x = capture (fn k => let
  29380.           val return = escape k
  29381.           in
  29382.             return (x ())
  29383.           end)
  29384.   end;
  29385.  
  29386.   which is called in the following loop:
  29387.  
  29388.   fun loop () = select loop
  29389. Comments: This should be constant space!
  29390. Status: fixed (again!) in 0.90
  29391. ----------------------------------------------------------------------
  29392. 634. Uncaught expception NotDirectory
  29393. Submitter:    Zhong Shao   (zsh@cs.princeton.edu)
  29394. Date:         Sept. 4, 1992
  29395. Version:      0.88 
  29396. System:       mipsb/riscos and mipsl/ultrix
  29397. Severity:     major 
  29398. Problem:      Uncaught expception NotDirectory
  29399. Code:
  29400. (**************************************************************************
  29401.  * THIS IS THE FILE getwd.sml ---------  Modified from SourceGroup        *
  29402.  * version 2.2  tools/sourcegroup/local/System/getwd.sml                  *
  29403.  **************************************************************************)
  29404.  
  29405.   structure GetWorkingDirectory :sig val getwd :unit -> string end = struct
  29406.  
  29407.   fun withInOutStreams (inS :instream, outS :outstream)
  29408.       (action :instream * outstream -> 'a -> 'b) (argument:'a) :'b =
  29409.     let val result = action (inS, outS) argument
  29410.                        handle exn => (close_in inS; close_out outS; raise exn)
  29411.      in
  29412.       close_out outS; close_in inS;
  29413.       result
  29414.     end
  29415.  
  29416.   val SYS_wait = 84
  29417.  
  29418.   fun waitForProcess () =
  29419.    (while (((System.Unsafe.CInterface.syscall (SYS_wait, System.Unsafe.cast 0))
  29420.       handle System.Unsafe.CInterface.SysError _ => 0) > 0) do ())
  29421.  
  29422.   fun firstLine (program:string, args :string list) =
  29423.     let fun strip_newline str =
  29424.              let val len = size str in
  29425.                if len > 0 then substring (str, 0, len - 1)
  29426.                           else str end
  29427.         fun first_line (inS,outS) () = strip_newline (input_line inS)
  29428.         val result =
  29429.           withInOutStreams (execute (program, args)) first_line ()
  29430.      in
  29431.       waitForProcess(); result
  29432.     end
  29433.  
  29434.   fun getwd () = firstLine ("/bin/pwd", [])
  29435.  
  29436.   end
  29437.  
  29438.   val _ = 
  29439.    (let
  29440.       val cwd = GetWorkingDirectory.getwd() 
  29441.       val _ = System.Directory.cd cwd
  29442.       val cwd = GetWorkingDirectory.getwd()
  29443.       val _ = System.Directory.cd cwd
  29444.       val cwd = GetWorkingDirectory.getwd()
  29445.       val _ = System.Directory.cd cwd
  29446.       val cwd = GetWorkingDirectory.getwd() 
  29447.       val _ = System.Directory.cd cwd
  29448.       val cwd = GetWorkingDirectory.getwd()
  29449.       val _ = System.Directory.cd cwd
  29450.       val cwd = GetWorkingDirectory.getwd()
  29451.       val _ = System.Directory.cd cwd
  29452.       val cwd = GetWorkingDirectory.getwd() 
  29453.       val _ = System.Directory.cd cwd
  29454.       val cwd = GetWorkingDirectory.getwd()
  29455.       val _ = System.Directory.cd cwd
  29456.       val cwd = GetWorkingDirectory.getwd()
  29457.       val _ = System.Directory.cd cwd
  29458.       val cwd = GetWorkingDirectory.getwd()
  29459.       val _ = System.Directory.cd cwd
  29460.  
  29461.     in print "\n \n This is correct! \n \n"
  29462.    end) handle _ => 
  29463.           (print "\n\n This is wrong, Why exceptions? \n\n")
  29464.  
  29465. Transcript:
  29466.  
  29467.   - use "getwd.sml";
  29468.  
  29469.  
  29470.    This is wrong, Why exceptions?
  29471.  
  29472.   structure GetWorkingDirectory :
  29473.     sig
  29474.       val getwd : unit -> string
  29475.     end
  29476.   [closing /u/zsh/tcps/work/new/bug/tt.sml]
  29477.   val it = () : unit
  29478.   -
  29479.  
  29480. Comments:  "Uncaught exception NotDirectory" happened RANDOMLY(50%)
  29481.            when doing "val cwd = GetWorkingDirectory.getwd();
  29482.            System.Directory.cd cwd;" This is why I did ten runs
  29483.            of it in the above script. I suspect the getwd.sml
  29484.            in SourceGroup is coded in an incompatible way with 
  29485.            the version 88's Directory.cd function in perv.sml (or 
  29486.            runtime/cfuns.c), since the above bug did not occur in 87. 
  29487.  
  29488.            This bug occurs (sometimes,say one out of two times) when 
  29489.            making smlsg using version88.
  29490.  
  29491.       ** This is probably another example of bug #651 (JHR, 10/6/92) **
  29492. Status: fixed
  29493. ----------------------------------------------------------------------
  29494. 635. byteArray.update and ByteArray.sub raise Ord
  29495. Submitter:     Robert Cooper (rcbc@cs.cornell.edu)
  29496. Date:         Sept 10, 1992
  29497. Version:     0.75 (broken in 0.89)
  29498. System:     any
  29499. Severity:     minor
  29500. Problem:     byteArray.update and ByteArray.sub raise Ord
  29501.         instead of Subscript
  29502. Transcript: 
  29503.     Standard ML of New Jersey, Version 0.89, September 4, 1992
  29504.     val it = () : unit
  29505.     - open ByteArray;
  29506.     open ByteArray
  29507.     - val a = array(2, 0);
  29508.     val a = - : bytearray
  29509.     - update (a, 2, 100);
  29510.  
  29511.     uncaught exception Ord
  29512.     - a sub 2;
  29513.  
  29514.     uncaught exception Ord
  29515.  
  29516. Comments:    The inline operators are incorrectly defined.
  29517. Status: fixed in 0.90
  29518. ----------------------------------------------------------------------
  29519. 636. Vector patterns don't work at top level
  29520. Submitter: Dave MacQueen
  29521. Date: 9/10/92
  29522. Version: 0.88
  29523. Severity: major
  29524. Problem: Vector patterns don't work at top level
  29525. Transcript: 
  29526.   Standard ML of New Jersey, Version 0.89, September 4, 1992
  29527.   val it = () : unit
  29528.   - val v = #[1,2,3];
  29529.   val v = #[1,2,3] : int vector
  29530.   - val #[a,b,c] = v;
  29531.   std_in:5.1-5.16 Warning: binding not exhaustive
  29532.           #[a,b,c] = ...
  29533.   - a;
  29534.  
  29535.   uncaught exception IntmapF
  29536.   - let val #[a,b,c] = v in a end;
  29537.   std_in:0.0-0.0 Warning: binding not exhaustive
  29538.           #[a,b,c] = ...
  29539.   val it = 1 : int
  29540. Status: fixed in 0.90
  29541. ----------------------------------------------------------------------
  29542. 637. Compiler bug printing signatures with polymorphic exceptions (same as 613)
  29543. Submitter: Gene Rollins
  29544. Date: 9/10/92
  29545. Version: 0.88?
  29546. Severity: minor
  29547. Problem: 
  29548. The Compiler reports a compiler bug when trying to print signatures that
  29549. contain polymorphic exceptions.  This happens with both 0.75 and 0.80 versions
  29550. on both sun4 and decstation machines running mach.
  29551. Code: 
  29552. Transcript: 
  29553. - signature SEQUENCE = sig 
  29554.    exception no_next of 'a
  29555.    end;
  29556. signature SEQUENCE = 
  29557.   sig
  29558.     exception no_next of Error: Compiler bug: domain
  29559. Comments:
  29560. If we set:
  29561.   System.Control.Print.signatures := 0;
  29562.  
  29563. the compiler compiles the signature fine, and does not report the compiler
  29564. bug.
  29565. [DBM:] Polymorphic exception specifications in signatures are (or should
  29566. be) illegal, so these should cause some error message.
  29567. Status: same as 613
  29568. ----------------------------------------------------------------------
  29569. 638. subnormal numbers
  29570. Submitter: Appel
  29571. Date: 9/15/92
  29572. Version: 0.89
  29573. System: Sparc
  29574. Severity: minor
  29575. Problem: The "ln" function does not expect subnormal numbers, and gives wrong
  29576. answers.  Other functions may have similar problems.
  29577.  
  29578. Code: 
  29579. Transcript: 
  29580. val x = 1.0E~160;
  29581. val x = 1.0E~160 : real
  29582. - x * x;
  29583. val it = 9.99988867182683E~321 : real
  29584. - ln it;
  29585. val it = ~4.05753556581235 : real
  29586. -
  29587. Comments:
  29588. Fix:
  29589. Status: fixed in 0.90
  29590. ----------------------------------------------------------------------
  29591. 639. multiple compiler compilations on sparc fail
  29592. Submitter: Pierre Cregut
  29593. Date: 9/15/92
  29594. Version: 0.89
  29595. System: SunOS 4.1, SPARC 2, 64MB
  29596. Severity: major
  29597. Problem: 
  29598.   When multiple compilations of the ML compiler are launched
  29599.   on a single sparc 2, some of them fail with "Bus error" or
  29600.   "Segmentation fault".
  29601. Transcript: 
  29602. I have done the experiment but forgot it... so here is the result of
  29603. launching 3 smlc (.89) on skye
  29604.  
  29605. One is Ok and has finished...
  29606. another:
  29607. > [closing elaborate/normalize.sml]
  29608. > [Compiling modules/moduleutil.sml]
  29609. > structure ModuleUtil : ...
  29610. > [Major collection... 7% used (1403140/20038536), 1040 msec]
  29611. > Bus error
  29612. and the last
  29613. > signature GENERAL = ...
  29614. > [closing boot/perv.sig]
  29615. > [Loading boot/system.sig]
  29616. > [Increasing heap to 24114k]
  29617. > Segmentation fault
  29618. who died very quickly !!
  29619. Comments:
  29620. Why did it asked for such a swap space suddenly: it is completely ridiculous
  29621. at that point...
  29622. Status: open
  29623. ----------------------------------------------------------------------
  29624. 640. flakiness of System.Env (particularly filterEnv)
  29625. Submitter: Sanjiva Prasad <sanjiva@ecrc.de>
  29626. Date: 9/16/92
  29627. Version: 0.88
  29628. Severity: major
  29629. Problem: 
  29630. Perhaps someone in your group has already discovered and fixed these bugs
  29631. in v88.  We had pulled over a copy of v88 to experiment with the new
  29632. environment features you had advertised (with the intention of trying out
  29633. an mini interpreter that does not maintain the application environment, but 
  29634. evaluates a syntax tree in a given environment). 
  29635.  
  29636. I mucked around a bit, trying to create some small environments by making 
  29637. type, structure, functor and value declarations, then using map, 
  29638. some list operations like rev and some auxiliary functions, and
  29639. (from System.Env) catalogEnv, topLevelEnvRef, staticPart and filterEnv.
  29640. Unfortunately, I kept getting Compiler Bug messages when I used filterEnv
  29641. (I organized my program carefully enough to isolate the occurrence of these
  29642. to the use of filterEnv).
  29643.  
  29644. The ugly part of the story is that although repeating the evaluation
  29645. resulted in the same bug message or exception being raised, there was
  29646. no pattern to it.  For instance, filtering out an environment from the top-level 
  29647. environment using a list of seven symbols -- obtained from applying
  29648. staticPart and then catalogEnv --  resulted in  a compiler bug message
  29649. "compstat" (I think it was that).  With a different list (again obtained
  29650. using list operations, catalogEnv, staticPart and topLevelEnvRef), I got
  29651. uncaught exception IntmapF,  and then with another list (this time built using
  29652. string-to-symbol functions in System.Symbol), I got another compiler bug
  29653. (I can't recall which).  In all cases, it is when trying to use filterEnv.
  29654. Comment: [dbm] can't reproduce
  29655. Status: open  
  29656. ----------------------------------------------------------------------
  29657. 641. higher-order functors give Compiler bug: PrintVal.switch: none ...
  29658. Submitter: Sanjiva Prasad <sanjiva@ecrc.de>
  29659. Date: 9/16/92
  29660. Version: 0.88
  29661. Severity: major
  29662. Problem: 
  29663.   Use of higher-order functors results in Compiler bug when a value
  29664.   of a datatype is printed.
  29665. Transcript: 
  29666. - signature SIG1 = sig type t    type u    val x:t       val y:u end;
  29667. signature SIG1 = 
  29668.   sig
  29669.     type t
  29670.     type u
  29671.     val x : t
  29672.     val y : u
  29673.   end
  29674. - structure A:SIG1 = struct type t=int    type u=bool    val x=5    val y=true end;
  29675. structure A : SIG1
  29676. - signature SIG2 = sig 
  29677. =                       functor Foo(X:SIG1) : sig val  z : A.t val  w: X.t end 
  29678. =                  end;
  29679.  
  29680. (* This was to test if the restriction on what names may be used -- relevant 
  29681.    for separate compilation -- was enforced in v88 *)
  29682.  
  29683. signature SIG2 = 
  29684.   sig
  29685.     functor Foo : <sig>
  29686.   end
  29687.  
  29688. - structure B : SIG2 = struct functor Foo(X:SIG1) = struct val z = A.x + 1 val w = X.x 
  29689. =                                                          type foo = bool 
  29690. =                                                   end
  29691. =                      end;
  29692. structure B : SIG2
  29693.  
  29694. (* This was to test if signature contraints of SIG2 were propagated down to the body
  29695.    of the functor. Pleasantly, it is *)
  29696.  
  29697. - open B;
  29698. open B
  29699.  
  29700. - structure C = Foo(A);
  29701. structure C : 
  29702.   sig
  29703.     val z : A.t
  29704.     val w : A.t
  29705.   end
  29706.  
  29707. - structure D :SIG1 = struct type t = bool type u = int val x = false val y = 7 end;
  29708. structure D : SIG1
  29709.  
  29710. - structure E = Foo(D);
  29711. structure E : 
  29712.   sig
  29713.     val z : A.t
  29714.     val w : D.t
  29715.   end
  29716.  
  29717. - C.w;
  29718. val it = 1 : A.t    (* should have been equal to A.x = 5  !!!!! *)
  29719.  
  29720. - A.x;
  29721. val it = 5 : A.t
  29722.  
  29723. - C.z;
  29724. val it = 6 : A.t    (* rightly so *)
  29725.  
  29726. - E.z;
  29727. val it = 6 : A.t    (* again rightly so *)
  29728.  
  29729. - E.w;            (* should have been false *)
  29730. val it = Error: Compiler bug: PrintVal.switch: none of the datacons matched
  29731.  
  29732. Status: fixed in 0.89
  29733. ----------------------------------------------------------------------
  29734. 642. Sourcegroup 2.1 dependency analysis fails (see also bug 649)
  29735. Submitter:      Amy Felty, felty@research.att.com
  29736. Date:        17 Sept 92
  29737. Version:        0.90a
  29738. System:         sun4 sparc
  29739. Severity:       major
  29740.  
  29741. Problem:        SG2.1 compiles, but doesn't execute propery. The last
  29742. version that I know of where it works properly is 0.87. In a call to
  29743. SourceGroup.make, one of the arguments is the name of the top-level
  29744. functor (ElpSymtab in this example). It should then be able to
  29745. determine all the necessary files to compile and build the structures.
  29746. Instead, it replies with:
  29747.  
  29748. % structure ElpSymtab undefined
  29749.  
  29750. Code:           I have put a tar file in ~felty/lp-sml/SGbug.tar. It
  29751. is not very large, but contains files in several subdirectories. (It
  29752. is a very small piece of the Lambda Prolog code.)
  29753.  
  29754. Transcript:     I'm including a transcript of the execution in 0.90a
  29755. with the bug, followed by a transcript of the working version in 0.87.
  29756.  
  29757. ------------------------
  29758. transcript for SML 0.90a
  29759. ------------------------
  29760. % /usr/local/sml/bin/sparc/sml-sg.90a
  29761. Standard ML of New Jersey, Version 0.90a September 16, 1992
  29762.   with SourceGroup 2.1 built on Wed Sep 16 20:11:34 EDT 1992
  29763. val it = () : unit
  29764. - use "build.sml";
  29765. val it = () : unit
  29766. val it = () : unit
  29767. val it = () : unit
  29768. structure SG : SOURCEGROUP
  29769. structure SA : SOURCEACTION
  29770. structure FL : FILELIST
  29771. val smlFiles = fn : string list -> string list
  29772. val mlyaccFiles = fn : string list -> string list
  29773. hash/Hash.sig
  29774. hash/Hash.sml
  29775. hash/link-hash.sml
  29776. val hashGroup = 1 : ?.group
  29777. sys/hasher.sml
  29778. sys/link-sys.sml
  29779. sys/location.sml
  29780. sys/profile.sml
  29781. sys/sys.sig
  29782. sys/sys_newjersey.fun
  29783. sys/time.sml
  29784. val sysGroup = 3 : ?.group
  29785. val libraries = [1,3] : ?.group list
  29786. [closing group-libraries.sml]
  29787. val it = () : unit
  29788. lam/basic.fun
  29789. lam/basic.sig
  29790. lam/term.fun
  29791. lam/term.sig
  29792. lam/naming.fun
  29793. lam/naming.sig
  29794. val lamGroup = 5 : ?.group
  29795. elp/elp_symtabs.fun
  29796. elp/elp_symtabs.sig
  29797. elp/link-elp.sml
  29798. val elpGroup = 7 : ?.group
  29799. val makeElp = fn : unit -> unit
  29800. [closing group.sml]
  29801. val it = () : unit
  29802. val make = fn : unit -> unit
  29803. % structure ElpSymtab undefined
  29804. val it = () : unit
  29805. [closing build.sml]
  29806. val it = () : unit
  29807. -----------------------
  29808. transcript for SML 0.87
  29809. -----------------------
  29810. % /usr/local/sml/bin/sparc/sml-sg
  29811. Standard ML of New Jersey, Version 0.87, July 31, 1992
  29812.   with SourceGroup 2.1 built on Mon Aug  3 14:02:28 EDT 1992
  29813. val it = () : unit
  29814. - use "build.sml";
  29815. val it = () : unit
  29816. val it = () : unit
  29817. val it = () : unit
  29818. structure SG : SOURCEGROUP
  29819. structure SA : SOURCEACTION
  29820. structure FL : FILELIST
  29821. val smlFiles = fn : string list -> string list
  29822. val mlyaccFiles = fn : string list -> string list
  29823. hash/Hash.sig
  29824. hash/Hash.sml
  29825. hash/link-hash.sml
  29826. val hashGroup = 1 : ?.group
  29827. sys/hasher.sml
  29828. sys/link-sys.sml
  29829. sys/location.sml
  29830. sys/profile.sml
  29831. sys/sys.sig
  29832. sys/sys_newjersey.fun
  29833. sys/time.sml
  29834. val sysGroup = 3 : ?.group
  29835. val libraries = [1,3] : ?.group list
  29836. [closing group-libraries.sml]
  29837. val it = () : unit
  29838. lam/basic.fun
  29839. lam/basic.sig
  29840. lam/term.fun
  29841. lam/term.sig
  29842. lam/naming.fun
  29843. lam/naming.sig
  29844. val lamGroup = 5 : ?.group
  29845. elp/elp_symtabs.fun
  29846. elp/elp_symtabs.sig
  29847. elp/link-elp.sml
  29848. val elpGroup = 7 : ?.group
  29849. val makeElp = fn : unit -> unit
  29850. [closing group.sml]
  29851. val it = () : unit
  29852. val make = fn : unit -> unit
  29853. [reading sys/time.sml]
  29854. [closing sys/time.sml]
  29855. [writing /shadow/12/people/felty/lp-sml/SGtest/sys/.@sys/time.sml.bin]
  29856. signature TIME
  29857. <other binding>
  29858. functor Time
  29859. <other binding>
  29860. [reading sys/sys.sig]
  29861. [closing sys/sys.sig]
  29862. [writing /shadow/12/people/felty/lp-sml/SGtest/sys/.@sys/sys.sig.bin]
  29863. signature SYS
  29864. <other binding>
  29865. [reading sys/sys_newjersey.fun]
  29866. [closing sys/sys_newjersey.fun]
  29867. [writing /shadow/12/people/felty/lp-sml/SGtest/sys/.@sys/sys_newjersey.fun.bin]
  29868. functor NewJersey
  29869. <other binding>
  29870. [reading sys/location.sml]
  29871. [closing sys/location.sml]
  29872. [writing /shadow/12/people/felty/lp-sml/SGtest/sys/.@sys/location.sml.bin]
  29873. signature LOCATION
  29874. <other binding>
  29875. functor Location
  29876. <other binding>
  29877. [reading sys/hasher.sml]
  29878. [closing sys/hasher.sml]
  29879. [writing /shadow/12/people/felty/lp-sml/SGtest/sys/.@sys/hasher.sml.bin]
  29880. functor Hasher
  29881. <other binding>
  29882. signature HASHER
  29883. <other binding>
  29884. [reading sys/link-sys.sml]
  29885. [closing sys/link-sys.sml]
  29886. [writing /shadow/12/people/felty/lp-sml/SGtest/sys/.@sys/link-sys.sml.bin]
  29887. <other binding>
  29888. <other binding>
  29889. <other binding>
  29890. <other binding>
  29891. <other binding>
  29892. <other binding>
  29893. <other binding>
  29894. <other binding>
  29895. [reading lam/term.sig]
  29896. [closing lam/term.sig]
  29897. [writing /shadow/12/people/felty/lp-sml/SGtest/lam/.@sys/term.sig.bin]
  29898. signature TERM
  29899. <other binding>
  29900. [reading lam/term.fun]
  29901. [closing lam/term.fun]
  29902. [writing /shadow/12/people/felty/lp-sml/SGtest/lam/.@sys/term.fun.bin]
  29903. functor Term
  29904. <other binding>
  29905. [reading lam/naming.sig]
  29906. [closing lam/naming.sig]
  29907. [writing /shadow/12/people/felty/lp-sml/SGtest/lam/.@sys/naming.sig.bin]
  29908. signature NAMING
  29909. <other binding>
  29910. [reading lam/basic.sig]
  29911. [closing lam/basic.sig]
  29912. [writing /shadow/12/people/felty/lp-sml/SGtest/lam/.@sys/basic.sig.bin]
  29913. signature BASIC
  29914. <other binding>
  29915. [reading lam/naming.fun]
  29916. [closing lam/naming.fun]
  29917. [writing /shadow/12/people/felty/lp-sml/SGtest/lam/.@sys/naming.fun.bin]
  29918. functor Naming
  29919. <other binding>
  29920. [reading lam/basic.fun]
  29921. [closing lam/basic.fun]
  29922. [writing /shadow/12/people/felty/lp-sml/SGtest/lam/.@sys/basic.fun.bin]
  29923. functor Basic
  29924. <other binding>
  29925. [reading hash/Hash.sig]
  29926. [closing hash/Hash.sig]
  29927. [writing /shadow/12/people/felty/lp-sml/SGtest/hash/.@sys/Hash.sig.bin]
  29928. signature HASH
  29929. <other binding>
  29930. [reading hash/Hash.sml]
  29931. [closing hash/Hash.sml]
  29932. [writing /shadow/12/people/felty/lp-sml/SGtest/hash/.@sys/Hash.sml.bin]
  29933. functor HashFun
  29934. <other binding>
  29935. [reading hash/link-hash.sml]
  29936. [closing hash/link-hash.sml]
  29937. [writing /shadow/12/people/felty/lp-sml/SGtest/hash/.@sys/link-hash.sml.bin]
  29938. <other binding>
  29939. <other binding>
  29940. [reading elp/elp_symtabs.sig]
  29941. [closing elp/elp_symtabs.sig]
  29942. [writing /shadow/12/people/felty/lp-sml/SGtest/elp/.@sys/elp_symtabs.sig.bin]
  29943. signature ELPSYMTAB
  29944. <other binding>
  29945. [reading elp/elp_symtabs.fun]
  29946. [closing elp/elp_symtabs.fun]
  29947. [writing /shadow/12/people/felty/lp-sml/SGtest/elp/.@sys/elp_symtabs.fun.bin]
  29948. functor ElpSymtab
  29949. <other binding>
  29950. [reading elp/link-elp.sml]
  29951. [closing elp/link-elp.sml]
  29952. [writing /shadow/12/people/felty/lp-sml/SGtest/elp/.@sys/link-elp.sml.bin]
  29953. <other binding>
  29954. <other binding>
  29955. <other binding>
  29956. <other binding>
  29957. <other binding>
  29958. <other binding>
  29959. <other binding>
  29960. <other binding>
  29961. val it = () : unit
  29962. [closing build.sml]
  29963. val it = () : unit
  29964.  
  29965. Comments:    Lal and John suggest that a regression test be made
  29966.         for source groups.
  29967. Status: fixed in 0.91 (Shao)
  29968. ----------------------------------------------------------------------
  29969. 643. building smld produces Compiler bug: DebugError: ...
  29970. Submitter:    John Reppy (jhr@research.att.com)
  29971. Date:         September 17, 1992
  29972. Version:     0.89
  29973. System:     n.a.
  29974. Severity:     major
  29975. Problem:     attempting to build smld produces an error
  29976. Code: 
  29977.   makeml -debug -sun4 sunos
  29978. Transcript: 
  29979.   makeml> (cd runtime; make clean)
  29980.   rm -f *.o lint.out prim.s linkdata allmo.s run
  29981.   makeml> rm -f mo
  29982.   makeml> ln -s ../mo.sparc mo
  29983.   ...
  29984.   [closing dbguser/hstore.sml]
  29985.   val it = () : unit
  29986.   val it = () : unit
  29987.   [debugging support included]
  29988.   structure DebugList : LIST
  29989.   [closing dbguser/list.sml]
  29990.   val it = () : unit
  29991.   Error: Compiler bug: DebugError:Static.locOfEvent bad APPev marking
  29992.  
  29993.   [closing dbguser/general.sml]
  29994.   [closing dbguser/load.sml]
  29995.  
  29996. Comments:
  29997.   This works in version 0.88.
  29998.  
  29999. Comments: [APT]
  30000.   I looked in and looked at this briefly.  I suspect some complication
  30001.   due to the introduction of type options in the absyn.
  30002.   The correct way to diagnose this sort of problem is:
  30003.  
  30004.   1) use makeml -debug0 to build a debugger version that doesn't attempt
  30005.   to execute dbguser/load.sml.
  30006.  
  30007.   2) execute dbguser/load.sml up to the file that causes problems.
  30008.  
  30009.   3) Set System.Control.debugging := true.  Under the debugger, this will
  30010.   cause the absyn of the pre- and post-instrumented versions of the code to
  30011.   be printed.  
  30012.  
  30013.   4) Try using "dbguser/general.sml" (in this case) and look where the MARKexps
  30014.   come in the absyn.  Compare this to what the code in debug/static.sml
  30015.   (where the exception was raised) is expecting.
  30016.  
  30017.   If you don't get anywhere with this, please leave the result of step 1
  30018.   around in 89/bin/mipsb (I usually call it smld0) and let me know; I'll try
  30019.   diagnosing from here.  Unfortunately, my machine is not up yet here, and
  30020.   telneting cross country is painfully slow...  I should have a proper environment
  30021.   for looking at this sort of bug by early next week.
  30022.  
  30023. Status: open
  30024. ----------------------------------------------------------------------
  30025. 644. checking for stale continuations
  30026. Submitter: MacQueen
  30027. Date: 9/17/92
  30028. Version: 0.89
  30029. Severity: major
  30030. Problem: 
  30031.   Checking for stale continuation returns at top level has been disabled
  30032.   (possibly by one of Tolmach's changes to interact).
  30033. Comments: See bug 145.
  30034. Status: open
  30035. ----------------------------------------------------------------------
  30036. 645. Compiler bug from bugs 183,228,343 code: CoreInfo.coreLty3
  30037. Submitter: Lal George
  30038. Date: 9/18/92
  30039. Version: 0.90
  30040. System: Sparc, SunOS
  30041. Severity: major
  30042. Problem: 
  30043.   Code for bugs 183, 228, 343 now causes "Error: Compiler bug: CoreInfo.coreLty3".
  30044. Code: /usr/local/sml/testing/bugs/tests/bug183.sml, etc.
  30045. Status: fixed in 0.91 (Shao)
  30046. ----------------------------------------------------------------------
  30047. 646. module test tile mod14.sml fails with Compiler bug: ModuleUtil: getFctStamp
  30048. Submitter: Lal George (regression testing)
  30049. Date: 9/18/92
  30050. Version: 0.90a (& 0.89)
  30051. Severity: major
  30052. Problem: 
  30053.   Module test case mod14.sml in /usr/local/sml/testing/hof/tests/mod14.sml
  30054.   fails with "Compiler bug: ModuleUtil: getFctStamp".
  30055. Status: fixed in 0.90
  30056. ----------------------------------------------------------------------
  30057. 647. PWR_2_CALLEESAVE not defined in some cases
  30058. Submitter:      Kjeld H. Mortensen (kjeld@metasoft.com)
  30059. Date:           9/22/92
  30060. Version:        0.89
  30061. System:         HP9000s400 HPUX8.0
  30062. Severity:       minor
  30063. Problem:        PWR_2_CALLEESAVE not defined in some cases, which shows
  30064.                 up when assembling prim.s.
  30065. Code:           PWR_2_CALLEESAVE will not be defined when CALLEESAVE
  30066.                 is already defined. This happens when HPUX (and M68) is 
  30067.                 defined, because makeml has a special case for this and ends
  30068.                 up calling cpp with -DCALLEESAVE=...
  30069. Transcript:     
  30070. Comments:
  30071. Fix:            If CALLEESAVE, HPUX, and M68 is defined then PWR_2_CALLEESAVE
  30072.                 should be set to 1 because CALLEESAVE has the default value 0.
  30073.                 I don't know if there are other cases (e.g. if -callee 
  30074.                 is used with makeml).
  30075. Status: open
  30076. ----------------------------------------------------------------------
  30077. 648. Compiler core dumps in the boot process for HP9000s400 HPUX8.0
  30078. Submitter:      Kjeld H. Mortensen (kjeld@metasoft.com)
  30079. Date:           9/22/92
  30080. Version:        0.89
  30081. System:         HP9000s400 HPUX8.0
  30082. Severity:       critical
  30083. Problem:        Compiler core dumps in the boot process
  30084. Code:           
  30085. Transcript:     Both 'makeml -m68 hpux8 -noshare' and 'makeml -m68 hpux8'
  30086.                 results in a core dump ("Illegal instruction" or 
  30087.                 "Memory fault").
  30088.  
  30089. neptune 65: makeml -m68 hpux8 -noshare
  30090. makeml> (cd runtime; make clean)
  30091.     rm -f *.o lint.out prim.s linkdata allmo.s run
  30092. makeml> rm -f mo
  30093. makeml> ln -s ../mo.m68 mo
  30094. makeml> (cd runtime; rm -f run allmo.o allmo.s)
  30095. makeml> (cd runtime; ...)
  30096. makeml>   /lib/cpp -DCALLEESAVE=0 -DM68 -DHPUX -DASM M68.prim.s > prim.s
  30097. makeml>   emacs -batch -l sun2hp.el prim.s prim.s
  30098. Wrote /d1/release/tools/njsml/work89/src/runtime/prim.s
  30099. makeml>   as -o prim.o prim.s
  30100. makeml> (cd runtime; make  MACHINE=M68 'DEFS= -DHPUX' CPP=/lib/cpp 'CFL=-Wl,-a,archive' 'AS=as' 'LIBS=')
  30101.     cc -O -Wl,-a,archive -DM68 -DHPUX -c run.c
  30102.     cc -O -Wl,-a,archive -DM68 -DHPUX -c run_ml.c
  30103.     cc -O -Wl,-a,archive -DM68 -DHPUX -c callgc.c
  30104.     cc -O -Wl,-a,archive -DM68 -DHPUX -c gc.c
  30105.     cc -O -Wl,-a,archive -DM68 -DHPUX -c export.c
  30106.     cc -O -Wl,-a,archive -DM68 -DHPUX -c timers.c
  30107.     cc -O -Wl,-a,archive -DM68 -DHPUX -c ml_objects.c
  30108.     cc -O -Wl,-a,archive -DM68 -DHPUX -c cfuns.c
  30109.     cc -O -Wl,-a,archive -DM68 -DHPUX -c cstruct.c
  30110.     cc -O -Wl,-a,archive -DM68 -DHPUX -c signal.c
  30111.     cc -O -Wl,-a,archive -DM68 -DHPUX -c exncode.c
  30112.     cc -O -Wl,-a,archive -DM68 -DHPUX -c malloc.c
  30113.     cc -O -Wl,-a,archive -DM68 -DHPUX -c mp.c
  30114.     cc -O -Wl,-a,archive -DM68 -DHPUX -c sync.c
  30115.     cc -O -Wl,-a,archive -DM68 -DHPUX -c allmo.c
  30116. "allmo.c", line 15: warning: incorrect combination of pointer and integer for operator '='
  30117.     cc -O -Wl,-a,archive -DM68 -DHPUX -o run run.o run_ml.o callgc.o gc.o export.o timers.o  ml_objects.o cfuns.o cstruct.o signal.o exncode.o malloc.o  mp.o sync.o prim.o allmo.o 
  30118. makeml> echo ( exportML "sml"; output(std_out,System.version); output(std_out,(chr 10)); output(std_out, "")); | runtime/run -m 8192 -r 5 -h 2048 IntM68
  30119.  
  30120. [Increasing heap to 2048k]
  30121. [Loading mo/CoreFunc.mo]
  30122. [Executing mo/CoreFunc.mo]
  30123. [Loading mo/Initial.mo]
  30124. ...
  30125. [Loading ArrayExt]
  30126. [Executing ArrayExt]
  30127. [Executing TypesUtil]
  30128. [Loading Sort]
  30129. makeml: 988 Illegal instruction - core dumped
  30130. neptune 66: 
  30131.  
  30132. Comments: The compiler boots fine on a Sun3, so it doesn't have to be
  30133.           an MC680x0 related problem.
  30134. Comments: [Kjeld]
  30135. I have an additional comment: if -g is turned on in runtime/Makefile
  30136. (i.e. all the runtime sources are compiled with -g and without -O),
  30137. SML/NJ will boot. BUT, the compiler is flaky. It dumps a core if
  30138. large integers are evaluated, and it yields compiler bug messages
  30139. now and then in code that was compiled successfully on previous
  30140. versions.
  30141.  
  30142. Let me know if I can be of any help.  I'm not sure what the right
  30143. way is for debugging this.
  30144.  
  30145. **** From Kjeld H. Mortensen, 11/22/92, version 0.92:
  30146. I have tried to build the compiler on our HP9000s400. In order to get to
  30147. the boot point I had to make the following modifications:
  30148.  
  30149. -------------------------
  30150. diff cfuns.c.orig cfuns.c     (because the gethostid call isn't known)
  30151. -------------------------
  30152. 30a31,33
  30153. > #ifdef HPUX
  30154. > #include <sys/utsname.h>
  30155. > #endif
  30156. 1432a1436,1446
  30157. > #ifdef HPUX
  30158. >     char        buf[SNLEN+1];
  30159. >     ML_val_t    name;
  30160. >     struct utsname utsname;
  30161. >
  30162. >     uname(&utsname);
  30163. >     bcopy ((char *)(utsname.idnumber), buf, SNLEN);
  30164. >     buf[SNLEN] = '\0';  /* insure null termination */
  30165. >     name = ML_alloc_string (msp, buf);
  30166. >     RETURN(msp, name);
  30167. > #else /* !HPUX */
  30168. 1442c1456
  30169. <
  30170. ---
  30171. > #endif /* HPUX */
  30172.  
  30173. -----------------------------
  30174. diff sun2hp.el.orig sun2hp.el   (see also 564 in the masterbugs list)
  30175. -----------------------------
  30176. 97,98c98
  30177. <       (goto-char point)
  30178. <       (beginning-of-line)
  30179. ---
  30180. >       (goto-char (- point 2))
  30181. 137a138
  30182. >   (replace-re "\\.word" "short")
  30183.  
  30184. The last change (converting .word to short) is new, and is thus not
  30185. mentioned
  30186. in 564.
  30187.  
  30188. These changes allowed me to get to the boot point (i.e. all C-sources could
  30189. be compiled). But then the compiler dumped a core. So, I have the following
  30190. bug report:
  30191.  
  30192. ===========================================
  30193. Submitter:      Kjeld H. Mortensen (kjeld@metasoft.com)
  30194. Date:           11/22/92
  30195. Version:        0.92
  30196. System:         HP9000s400 (M68k), HPUX 8.0
  30197. Severity:       Major
  30198. Problem:        Compiler fails to boot.
  30199. Code:           
  30200. Transcript:     
  30201. neptune 180: makeml -m68 hpux8 -noshare
  30202. makeml> (cd runtime; make clean)
  30203.         rm -f *.o lint.out prim.s linkdata allmo.s run
  30204. makeml> rm -f mo
  30205. makeml> ln -s ../mo.m68 mo
  30206. makeml> (cd runtime; rm -f run allmo.o allmo.s)
  30207. makeml> (cd runtime; ...)
  30208. makeml>   /lib/cpp -DCALLEESAVE=0 -DM68 -DHPUX -DASM M68.prim.s > prim.s
  30209. makeml>   emacs -batch -l sun2hp.el prim.s prim.s
  30210. Wrote /d1/release/tools/njsml/work92/src/runtime/prim.s
  30211. makeml>   as -o prim.o prim.s
  30212. makeml> (cd runtime; make  MACHINE=M68 'DEFS= -DHPUX' CPP=/lib/cpp 
  30213. 'CFL=-Wl,-a,archive' 'LDFLAGS=' 'AS=as' 'LIBS=')
  30214.         cc -O -Wl,-a,archive -DM68 -DHPUX -c run.c
  30215.         cc -O -Wl,-a,archive -DM68 -DHPUX -c run_ml.c
  30216.         cc -O -Wl,-a,archive -DM68 -DHPUX -c callgc.c
  30217.         cc -O -Wl,-a,archive -DM68 -DHPUX -c gc.c
  30218.         cc -O -Wl,-a,archive -DM68 -DHPUX -c export.c
  30219.         cc -O -Wl,-a,archive -DM68 -DHPUX -c timers.c
  30220.         cc -O -Wl,-a,archive -DM68 -DHPUX -c ml_objects.c
  30221.         cc -O -Wl,-a,archive -DM68 -DHPUX -c cfuns.c
  30222.         cc -O -Wl,-a,archive -DM68 -DHPUX -c cstruct.c
  30223.         cc -O -Wl,-a,archive -DM68 -DHPUX -c signal.c
  30224.         cc -O -Wl,-a,archive -DM68 -DHPUX -c exncode.c
  30225.         cc -O -Wl,-a,archive -DM68 -DHPUX -c malloc.c
  30226.         cc -O -Wl,-a,archive -DM68 -DHPUX -c mp.c
  30227.         cc -O -Wl,-a,archive -DM68 -DHPUX -c sync.c
  30228.         cc -O -Wl,-a,archive -DM68 -DHPUX -c allmo.c
  30229.         cc -O -Wl,-a,archive -DM68 -DHPUX  -o run run.o run_ml.o callgc.o
  30230. gc.o
  30231. export.o timers.o  ml_objects.o cfuns.o cstruct.o signal.o exncode.o
  30232. malloc.o 
  30233. mp.o sync.o prim.o allmo.o
  30234. makeml> echo ( exportML "sml"; output(std_out,System.version);
  30235. output(std_out,(chr 10)); output(std_out, "")); | runtime/run -m 8192 -r 5 
  30236. -h 2048 IntM68
  30237.  
  30238. [Increasing heap to 2048k]
  30239. [Loading mo/CoreFunc.mo]
  30240. [Executing mo/CoreFunc.mo]
  30241. [Loading mo/Initial.mo]
  30242. [Executing mo/Initial.mo]
  30243. Initial done
  30244. [Loading mo/Loader.mo]
  30245. [Executing mo/Loader.mo]
  30246. makeml: 3591 Memory fault - core dumped
  30247.  
  30248. Comments:
  30249.   - I have been succesful building the compiler without '-noshare', 
  30250.     but sometimes it gives a bus error when it gets to "Go for it". 
  30251.  
  30252.   - The version that was successfully build with 'makeml -m68 hpux8' dumps 
  30253.     a core when evaluating an integer that is too large:
  30254.         neptune 205: sml
  30255.         Standard ML of New Jersey, Version 0.92, November 18, 1992
  30256.         val it = () : unit
  30257.         - 536870911;  (* 2^29 - 1 *)
  30258.         val it = 536870911 : int
  30259.         - 536870912;  (* 2^29 *)
  30260.         Illegal instruction (core dumped)
  30261.  
  30262.   - This is probably the same problem as in 648 (masterbugs).
  30263.  
  30264.   - The system builds fine on our Sun3 (also M68k) and doesn't core dump on
  30265.     large integers.
  30266.  
  30267.  
  30268. Status: open
  30269. ----------------------------------------------------------------------
  30270. 649. too strong optimization of datatype constructor (same as 642)
  30271. Submitter: Pierre Cregut
  30272. Date: 9/22/92
  30273. Version: 0.89
  30274. Severity: critical
  30275. Problem: 
  30276.   Printing simple datatype value causes "Compiler bug: constant datacon in
  30277.   decon".
  30278. Code: 
  30279.   datatype dt = a of int | b of unit; (* a is necessary *)
  30280.   b ();
  30281. Transcript: 
  30282.   datatype  dt
  30283.   con a : int -> dt
  30284.   con b : unit -> dt
  30285.   val it = b Error: Compiler bug: constant datacon in decon
  30286.  
  30287.   Another version is that a piece of code is not executed
  30288.   if it is an argument of such a constructor.
  30289.   ----------------------------------------------------
  30290.   - (b (print "aa\n") ; ());
  30291.   val it = () : unit
  30292. Comment:
  30293.   That is what happened in sourcegroup.
  30294.   To make connections, sourcegroup parse the file
  30295.   The toplevel rule is of type unit so a constructor
  30296.   " interdec of unit " is associated (interdec is the
  30297.   name of the rule). 
  30298.   Because of the too strong optimization, the body
  30299.   of the rule that updates the tables by side
  30300.   effect is never executed, so source group never hears
  30301.   about the structures contained in the files it looks at.
  30302. Status: fixed in 0.91 (Shao)
  30303. ----------------------------------------------------------------------
  30304. 650. Real.realfloor has wrong type
  30305. Submitter: John Reppy
  30306. Date: 9/27/92
  30307. Version: 0.90
  30308. Severity: minor
  30309. Problem: 
  30310.   Isn't realfloor supposed to have type real -> real?
  30311. Transcript: 
  30312.   Standard ML of New Jersey, Version 0.90 September 22, 1992
  30313.   val it = () : unit
  30314.   - Real.realfloor;
  30315.   val it = fn : 'a -> 'b
  30316. Fix: obvious
  30317. Status: fixed in 0.91 
  30318. ----------------------------------------------------------------------
  30319. 651. System.Directory.cd fails on numbers as directory names
  30320. Submitter: Konrad Slind
  30321. Date: 9/28/92
  30322. Version: 0.90
  30323. System: MIPS/RISCos 4.52
  30324. Severity: major
  30325. Problem: 
  30326.   System.Directory.cd doesn't seem to recognize numbers as possible directory
  30327.   names:
  30328. Transcript: 
  30329.   $ mkdir 7
  30330.   $ sml
  30331.   Standard ML of New Jersey, Version 0.90 September 22, 1992
  30332.   val it = () : unit
  30333.   - System.Directory.cd "7";
  30334.  
  30335.   uncaught exception NotDirectory
  30336.   -
  30337. Status: fixed in 0.91
  30338. ----------------------------------------------------------------------
  30339. 652. Compiler bug: contmap enterv 123 building HOL
  30340. Submitter:      elsa  elsa@research.att.com
  30341. Date:        28 September 
  30342. Version:        90, 91a
  30343. System:         MIPS & SPARC, UNIX
  30344. Severity:       critical
  30345. Problem:        compiler quits with Compiler bug: contmap enterv 123
  30346. Comment: [Elsa Gunter, 9/29/92]
  30347.   I spent some time last night removing the HOL code from the example.
  30348. Below is a mimimal example that causes the problem.  Along my descent
  30349. I found that the process of elimination was VERY NON-monotonic.  At
  30350. some time during the elimination process I had 
  30351.      if true then 2 else 2
  30352. which could note be replaced by 2 without the bug going away.
  30353. However, after removing some other aspects, the if_then_else was no
  30354. longer necessary.  At some point, the length of the string in the
  30355. exception being handled made a difference, but now it only matters
  30356. that there is a string.  There were other fluxuations as well.  I'm
  30357. afraid I left them on my machine at home, but if you need them, I can
  30358. try to bring them in tomorrow.
  30359.   This is very possibly not the only minimal code that causes this
  30360. bug.  I found that exceptions A and B must be different, that the one
  30361. being handled needed to take a record with at least one field having
  30362. string type and that that field had have a match against a string,
  30363. i.e., not a wild-card.
  30364. Code:
  30365. (* File: bug-652.sml *)
  30366.  
  30367. exception A
  30368.  
  30369. exception B of int*string
  30370.  
  30371. val _ = (raise A) handle B (_,"") => 2
  30372.  
  30373. (* end of file *)
  30374. Transcript:
  30375.  
  30376. shadow% sml
  30377. Standard ML of New Jersey, Version 0.90 September 22, 1992
  30378. val it = () : unit
  30379. - use "bug-652.sml";
  30380. Error: Compiler bug: contmap enterv 123
  30381. [closing bug-652.sml]
  30382. - exception A;
  30383. exception A
  30384. - exception B of int*string;
  30385. exception B
  30386. - val _ = (raise A) handle B (_,"") => 2;
  30387. Error: Compiler bug: CoreInfo.coreLty3
  30388.  
  30389. Another variation of the bug, still present in 91b:
  30390. Code:
  30391. (* File: bug.sml *)`
  30392.  
  30393. structure C =
  30394. struct
  30395. exception A
  30396. exception B of int * string
  30397. val C = (raise A) handle B (_,"") => 2
  30398. end
  30399.  
  30400. Transcript:
  30401. hunny% sml
  30402. Standard ML of New Jersey, Version 0.91a, October 1, 1992
  30403. val it = () : unit
  30404. - use "bug.sml";
  30405. Error: Compiler bug: contmap enterv 123
  30406. [closing bug.sml]
  30407. -
  30408.  
  30409. Another variation: (from Sheard at ogi)
  30410. - exception foo;
  30411. - fun bar x = raise foo;
  30412. Error: Compiler bug: CoreInfo.coreLty3
  30413.  
  30414. Comments:
  30415.   This is a variation on bug 652.  If you unwrap the code from within
  30416. the structure then things work.  However it still bombs if the code is
  30417. all inside a structure.
  30418.  
  30419. Comments:
  30420.   Konrad says that the problem was in 88 as well.
  30421.  
  30422. Comments: [Zhong Shao, 10/6/92]
  30423.    The compiler bug: contmap enterv 123 has been there for a long long time.
  30424.    Though previously, it occurs as a compiler bug: MipsCM.select: bad dst.
  30425.    These  are caused by meaningless cps expressions such as
  30426.                  SELECT(INT 0,1,v,...) , APP(INT 0, ...)
  30427.    which are produced by the constant folding optimization on data constructors
  30428.    and exception constructors. A short but temporary fix is to let contmap.sml
  30429.    not check the validity of these expressions and let each target code 
  30430.    generator generate some code for SELECT(INT 0,1,v,...). Ideally this should
  30431.    be fixed by letting the SELECT in Lambda and CPS depend on the auxiliary 
  30432.    variable generated in each branch and switch statement, and controlling 
  30433.    the constant-folding on SELECT. 
  30434.  
  30435. Status: open
  30436. ----------------------------------------------------------------------
  30437. 653. VECTOR signature isn't pervasive (unlike ARRAY)
  30438. Submitter:    Cliff Krumvieda (cliff@cs.cornell.edu)
  30439. Date:         September 30, 1992
  30440. Version:     0.90
  30441. System:     all
  30442. Severity:     minor
  30443. Problem:     VECTOR signature isn't pervasive (unlike ARRAY)
  30444. Code: 
  30445. Transcript: 
  30446.   Standard ML of New Jersey, Version 0.90 September 22, 1992
  30447.   val it = () : unit
  30448.   - signature A = ARRAY;
  30449.   signature A = 
  30450.     sig
  30451.       type 'a array
  30452.       exception Size
  30453.       exception Subscript
  30454.       val array : int * '1a -> '1a array
  30455.       val arrayoflist : '1a list -> '1a array
  30456.       val length : 'a array -> int
  30457.       val sub : 'a array * int -> 'a
  30458.       val tabulate : int * (int -> '1a) -> '1a array
  30459.       val update : 'a array * int * 'a -> unit
  30460.     end
  30461.   - signature V = VECTOR;
  30462.   std_in:3.15-3.20 Error: VECTOR undefined (parser)
  30463.   std_in:3.15-3.20 Error: unbound signature: VECTOR
  30464. Comments:
  30465. Fix:        add VECTOR to boot environment
  30466. Status: fixed in 0.91
  30467. ----------------------------------------------------------------------
  30468. 654. System.Directory.cd fails on valid pathnames (same as 651)
  30469. Submitter:      Elsa L. Gunter, elsa@resaerch.att.com
  30470. Date:        1 October 1992
  30471. Version:        90 (although I haven't tried earlier)
  30472. System:         Sparc, SunOS (although I haven't tried others)
  30473. Severity:       major
  30474. Problem:        strings from execute don't mix with System.Directory.cd
  30475.                 (or not all strings are ccreated equal)
  30476.  
  30477. Code: The following can cause problems when loaded with use, but more
  30478.       reliably causes problems when entered interactively, or so I've
  30479.       found.
  30480.  
  30481. fun strip_newline (str) = substring (str, 0, size(str) - 1);
  30482.  
  30483. fun cwd () =
  30484.     strip_newline (input_line ((fn (x,_) => x) (execute ("/bin/pwd",[]))));
  30485.  
  30486. val src_dir = cwd ();
  30487. val tmp = "/base/elsa/working/hol92/hol90.v5/src";
  30488. val t = (tmp = src_dir);
  30489. val _ = System.Directory.cd src_dir;
  30490. val _ = System.Directory.cd tmp;
  30491. val _ = System.Directory.cd (src_dir ^ "/..");
  30492. val _ = System.Directory.cd src_dir;
  30493.  
  30494. Transcript:
  30495.  
  30496. tiree% sml
  30497. Standard ML of New Jersey, Version 0.90 September 22, 1992
  30498. val it = () : unit
  30499. - fun strip_newline (str) = substring (str, 0, size(str) - 1);
  30500. val strip_newline = fn : string -> string
  30501. - fun cwd () =
  30502.     strip_newline (input_line ((fn (x,_) => x) (execute ("/bin/pwd",[]))));
  30503. = val cwd = fn : unit -> string
  30504. - val src_dir = cwd ();
  30505. val src_dir = "/base/elsa/working/hol92/hol90.v5/src" : string
  30506. - val tmp = "/base/elsa/working/hol92/hol90.v5/src";
  30507. val tmp = "/base/elsa/working/hol92/hol90.v5/src" : string
  30508. - val t = (tmp = src_dir);
  30509. val t = true : bool
  30510. - val _ = System.Directory.cd src_dir;
  30511.  
  30512. uncaught exception NotDirectory
  30513. - val _ = System.Directory.cd tmp;
  30514. - val _ = System.Directory.cd (src_dir ^ "/..");
  30515. - val _ = System.Directory.cd src_dir;
  30516.  
  30517. uncaught exception NotDirectory
  30518.  
  30519. Comments:
  30520. -- The problem is intermittent; the same code seems to behave
  30521. differently on the same machine under similar circumstances.
  30522. -- Strings that are entered by hand, or are built by sml processes,
  30523. such as concatenation seem not to cause the problem.  Only strings
  30524. created by execute (and input_line) seem to cause it.
  30525. -- I haven't been able to reproduce it just now, but it I recollect
  30526. that multiple executions of the same coomand (namely
  30527. System.Directory.cd src_dir; without src_dir being rebound in between)
  30528. could succeed for a while and then fail.
  30529.  
  30530. Fix: add "\000" to pathnames
  30531. Status: fixed in 0.91
  30532. ----------------------------------------------------------------------
  30533. 655. Compiling Isabelle-92 generates a bus error
  30534. Submitter:      Lal George
  30535. Date:        4 Oct. '92
  30536. Version:        0.88, 0.91a (0.89, 0.90 expose the CoreLty3 bug)
  30537. System:         SPARC and MIPSEB
  30538. Severity:       critical
  30539. Problem:        Generates a bus error(coredump) during compilation.
  30540. Code:           
  30541.     
  30542.     I haven't tried to narrow the code down yet, however, at 
  30543.     Bell Labs the following is sufficient to expose the bug:
  30544.  
  30545.         cd /usr/local/sml/isabelle-92/92/Pure
  30546.  
  30547.     Under SML:
  30548.  
  30549.         app use ["NJ.ML","ROOT.ML"];
  30550.  
  30551. Transcript:
  30552.  
  30553.     <... lots of stuff deleted ...>
  30554.  
  30555.     structure Earley : PARSER
  30556.     structure TypeExt : TYPE_EXT
  30557.     structure SExtension : SEXTENSION
  30558.     structure Pretty : PRETTY
  30559.     structure Printer : PRINTER
  30560.     Bus error(coredump)
  30561.  
  30562. Code: [dbm, 10/10/92: following causes bus error in 91a]
  30563.   structure A = struct end;
  30564.  
  30565.   signature S =
  30566.   sig
  30567.     local open A in  (* this must be present *)
  30568.       val x : unit  (* must have second value beside f, either before or after *)
  30569.       val f: unit -> unit
  30570.     end
  30571.   end;
  30572.  
  30573.   structure B : S =  (* must be constrained by S *)
  30574.   struct
  30575.     val x = ()
  30576.     fun f() = ()
  30577.   end;
  30578.  
  30579.   val _ = B.f();  (* causes Bus error *)
  30580.  
  30581. Comment: [dbm] It's clear that the bug is called by the local spec form.
  30582.  
  30583. Status: open
  30584. ----------------------------------------------------------------------
  30585. 656. Excessive dead code
  30586. Submitter:      Lal George
  30587. Date:        5th October, 92
  30588. Version:        0.90
  30589. System:         SPARC
  30590. Severity:       major
  30591. Problem:        Lot of dead code left around.
  30592. Code:           
  30593.  
  30594.       structure X = struct
  30595.  
  30596.     (* fold function "f" over the sublists of "(x::xs)" of size "n", starting
  30597.        with value "r", and appending "p" to each sublist *)
  30598.  
  30599.     fun folds_onto([],_,r,p,f) = r
  30600.       | folds_onto(x::xs,1,r,p,f) = folds_onto(xs,1,f(r,x::p),p,f) 
  30601.       | folds_onto(x::xs,n,r,p,f) = folds_onto(xs,n,
  30602.                            folds_onto(xs,n-1,r,x::p,f),
  30603.                            p,f)
  30604.  
  30605.     val l = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
  30606.     val n = 10
  30607.  
  30608.     fun doit() = folds_onto(l,n,0,[],fn (total,l) => total+length(l))
  30609.      end
  30610.  
  30611. Transcript:
  30612.  
  30613.     Toggling the Control.saveLvarNames, and CG.printit flags, a 
  30614.     partial output  from cpsopt is shown below: 
  30615.     (arrows point to dead code)
  30616.  
  30617.     ...
  30618.          folds_onto12224(12238,n12239,r12240,p12241,f12242,12124) =
  30619.             if boxed(12238) [12135] then
  30620.                12238.0 -> x12136
  30621.                12238.1 -> xs12137
  30622.                if ineq((I)1,n12239) [12169] then
  30623.                   12150(12226) =
  30624. -->                  {xs12137,n12239,12226,p12241,f12242} -> 12152
  30625.                      folds_onto12224(xs12137,n12239,12226,p12241,f12242,12124)
  30626.                   -(n12239,(I)1) -> 12153
  30627.                   {x12136,p12241} -> 12154
  30628. -->               {xs12137,12153,r12240,12154,f12242} -> 12155
  30629.                   folds_onto12224(xs12137,12153,r12240,12154,f12242,12150)
  30630.                else
  30631.                   12164(12228) =
  30632. -->                  {xs12137,(I)1,12228,p12241,f12242} -> 12166
  30633.                      folds_onto12224(xs12137,(I)1,12228,p12241,f12242,12124)
  30634.                   {x12136,p12241} -> 12167
  30635.                   {r12240,12167} -> 12168
  30636.                   f12242(12168,12164)
  30637.             else
  30638.                12124(r12240)
  30639.          {(I)20,(I)0} -> 12174
  30640.          {(I)19,12174} -> 12175
  30641.          {(I)18,12175} -> 12176
  30642.     ...
  30643.  
  30644. Comment:
  30645.     I know that several rounds of contract are done on this
  30646.     fragment, and the dead code exists after each round. For 
  30647.     some mysterious reason, code in cps/contract, that should 
  30648.     remove this, does not seem to work.
  30649.  
  30650.   Andrew Says:
  30651.     This is because System.Control.CG.reducemore is 15, which causes
  30652.     cpsopt to give up early when it sees diminishing returns.
  30653.     For documentation that this is a good idea, see Compiling with Continuations,
  30654.      figure 15.11, page 192.
  30655.  
  30656. Status: not a bug.
  30657. ----------------------------------------------------------------------
  30658. 657. vector values not prettyprinted
  30659. Date:        Oct 12, 1992
  30660. Version:     0.91c
  30661. System:     all
  30662. Severity:     minor
  30663. Problem:     new pretty printing code doesn't handle vectors
  30664. Code: 
  30665. Transcript: 
  30666.  
  30667.   Standard ML of New Jersey, Version 0.90 September 22, 1992
  30668.   val it = () : unit
  30669.   - #[1,2,3];
  30670.   val it = #[1,2,3] : int vector
  30671.  
  30672.   Standard ML of New Jersey, Version 0.91c, October 12, 1992
  30673.   val it = () : unit
  30674.   - #[1,2,3];
  30675.   val it = prim? : int vector
  30676. Status: fixed in 0.92
  30677. ----------------------------------------------------------------------
  30678. 658. Compiler bug: PrintVal.switch: none of the datacons matched
  30679. Submitter: John Reppy
  30680. Date: 10/13/92
  30681. Version: 0.91c
  30682. System: SPARC 2, SunOS 4.0.1
  30683. Severity: critical
  30684. Problem: 
  30685.   Compiler bug: PrintVal.switch: none of the datacons matched
  30686.   caused by Format.compileFormat
  30687. Transcript: 
  30688.   - Format.compileFormat "x = %d";
  30689.   Error: Compiler bug: PrintVal.switch: none of the datacons matched
  30690. Status: fixed in 0.91
  30691. ----------------------------------------------------------------------
  30692. 659. uncaught exception SpillFreemap in closure profiling
  30693. Submitter:      Zhong Shao 
  30694. Date:           October 12, 1992
  30695. Version:        from 0.86 - 0.90
  30696. System:         mips 
  30697. Severity:       minor
  30698. Problem:        uncaught exception SpillFreemap in closure profiling
  30699. Code:           
  30700. (* bug.sml *)
  30701.   structure S =
  30702.     struct
  30703.       val a = fn x => x
  30704.       val b = fn x => x
  30705.       val c = fn x => x
  30706.       val d = fn x => x
  30707.       val e = fn x => x
  30708.       val f = fn x => x
  30709.       val g = fn x => x
  30710.       val h = fn x => x
  30711.       val i = fn x => x
  30712.       val j = fn x => x
  30713.     end
  30714.  
  30715. Transcript:     
  30716.   haven% sml
  30717.   Standard ML of New Jersey, Version 0.90 September 22, 1992
  30718.   val it = () : unit
  30719.   - System.Control.CG.allocprof := true;
  30720.   val it = () : unit
  30721.   - use "bug.sml";
  30722.   [closing src/bug.sml]
  30723.  
  30724.   uncaught exception SpillFreemap
  30725.   -
  30726.  
  30727. Comments:
  30728.   in cps/spill.sml, the instrumenting code for profiling spill records
  30729.   are inserted at the wrong place. 
  30730. Status: fixed in 0.91
  30731. ----------------------------------------------------------------------
  30732. 660. signals in background sml
  30733. Submitter:     Doug McIlroy (doug@research.att.com)
  30734. Date:         October 22, 1992
  30735. Version:     0.90
  30736. System:     all
  30737. Severity:     major for non-interactive programs
  30738.  
  30739. Problem:     the inherited signal handler state of the SML process
  30740.         is getting trashed.  This means that an SML program
  30741.         running in the background still receives signals, even
  30742.         though the shell has disabled them.
  30743.  
  30744. Fix:        The fix will take a bit of work, since the responsibility
  30745.         for signal handling is spread throughout the system.
  30746.         We will have to make the signal handler state (enabled,
  30747.         default, ignored) more visible at the System.Signals
  30748.         level, and the top-level loop and other initialization
  30749.         code will have to check for ignored signals when setting
  30750.         the default handlers.  (JHR)
  30751. Status: open
  30752. ----------------------------------------------------------------------
  30753. 661. prettyprinter -- Compiler bug: PPTable.install_pp
  30754. Submitter:      Lal George
  30755. Date:        28 October 1992
  30756. Version:        0.91
  30757. System:         all
  30758. Severity:       minor
  30759. Problem:        install_pp incorrectly raises a compiler bug message
  30760. Code:           
  30761.     val _ = System.PrettyPrint.install_pp ["foo","bar"] Array.update
  30762.     
  30763. Transcript:
  30764.  
  30765.      Error: unbound structure foo in path foo.bar
  30766.     Error: Compiler bug: PPTable.install_pp
  30767. Comments:
  30768.  
  30769.     The first error message is also printed with an additional 
  30770.     blank space. 
  30771. Fix:
  30772.     In file print/pptable and function install_pp, replace:
  30773.          | _ => ErrorMsg.impossible "PPTable.install_pp"
  30774.     with
  30775.          | _ => ErrorMsg.complain "install_pp: Malformed path"
  30776.     May as well do the same thing with fun make_path.
  30777.     [dbm] Used ErrorMsg.errorNoFile for this and make_path --
  30778.     no more calls of ErrorMsg.impossible in pptable.sml.
  30779. Status: fixed in 0.92 (dbm)
  30780. ----------------------------------------------------------------------
  30781. 662. delayed interrupt on MIPS
  30782. Submitter: Dave MacQueen
  30783. Date: 10/28/92
  30784. Version: 0.91
  30785. System: MIPS/RISCOS 4.52
  30786. Severity: minor
  30787. Problem: 
  30788.   Typing the interrupt character (e.g. ^C) doesn't interrupt sml until
  30789.   after a newline is typed.
  30790. Comments:
  30791.   This could be fixed, but the piping into sml would hang under csh.
  30792.   This is really a RISCos bug.
  30793. Status: not our bug
  30794. ----------------------------------------------------------------------
  30795. 663. gc loop on illegal character
  30796. Submitter: Lal George
  30797. Date: 10/28/92
  30798. Version: 0.91
  30799. System: SPARC, MIPS
  30800. Severity: major
  30801. Problem: 
  30802.   Typing an illegal character (e.g. ^H) at top level causes an
  30803.   infinite gc loop after the illegal character message.
  30804. Fix: [Lal George]
  30805.   The fix is to generate ml.lex.sml with a version of lexgen.sml 
  30806.   that has the latest bug fixes. The one on /usr/local/sml/bin/sparc
  30807.   does fine.
  30808. Status: fixed in 0.92a
  30809. ----------------------------------------------------------------------
  30810. 664. installing on Sony RISC NEWS
  30811. Submitter:      KONO Shinji <kono@csl.sony.co.jp>
  30812. Date:        Wed Nov  4 17:34:01 JST 1992
  30813. Version:        0.75
  30814. System:         Sony RISC NEWS, NEWS-OS Release 4.1R
  30815. Severity:       minor
  30816. Problem:        Installation 
  30817. Code:           makeml -mips news
  30818. Transcript:     EXC_OV and cache clear system call are machine dependent
  30819. Comments:       I'm afraid this type of mahcine is not famous in U.S. But
  30820.         I'm sure it is used in Japan...
  30821. Fix:        Diffs are appended..
  30822. --------
  30823. Shinji Kono          kono@csl.sony.jp
  30824. Sony Computer Science Laboratory, Inc.
  30825.  
  30826.  
  30827. diff -c ./makeml /site/unicorn/export/src/Language/sml-0.75/src/makeml
  30828. *** ./makeml    Wed Nov  4 15:35:55 1992
  30829. --- /site/unicorn/export/src/Language/sml-0.75/src/makeml    Tue Sep  8 09:55:11 1992
  30830. ***************
  30831. *** 129,135 ****
  30832.           ENDIAN=Big
  30833.           case $1 in
  30834.           riscos) OPSYS=RISCos; CFL="$CFL -systype bsd43" ;;
  30835. -         news)   OPSYS=BSD;;
  30836.           mach)   OPSYS=MACH; DEFS="$DEFS -DBSD" ;;
  30837.           *)
  30838.               echo "$CMD must specify opsys arg for MIPS (riscos or mach)"
  30839. --- 129,134 ----
  30840. *** runtime/MIPS.dep.c    Wed Nov  4 16:28:06 1992
  30841. --- /site/unicorn/export/src/Language/sml-0.75/src/runtime/MIPS.dep.c    Tue Sep  8 09:54:00 1992
  30842. ***************
  30843. *** 5,18 ****
  30844.    * MIPS dependent code for SML/NJ runtime kernel.
  30845.    */
  30846.   
  30847. - #ifdef sony_news
  30848. - #include <machine/cpu.h>  /* for EXC_OV */
  30849. - #else
  30850.   #ifndef SGI
  30851.   #include <mips/cpu.h>  /* for EXC_OV */
  30852.   #else
  30853.   #include <sys/sbd.h>  /* for EXC_OV */
  30854. - #endif
  30855.   #endif
  30856.   #ifndef SGI
  30857.   #include <syscall.h>
  30858. --- 5,14 ----
  30859. diff -c runtime/exncode.c /site/unicorn/export/src/Language/sml-0.75/src/runtime/exncode.c
  30860. *** runtime/exncode.c    Wed Nov  4 16:27:33 1992
  30861. --- /site/unicorn/export/src/Language/sml-0.75/src/runtime/exncode.c    Tue Sep  8 09:54:03 1992
  30862. ***************
  30863. *** 6,19 ****
  30864.    */
  30865.   
  30866.   #ifdef MIPS
  30867. - #ifdef sony_news
  30868. - #include <machine/cpu.h>   /* for EXC_OV */
  30869. - #else
  30870.   #ifndef SGI
  30871.   #include <mips/cpu.h>   /* for EXC_OV */
  30872.   #else
  30873.   #include <sys/sbd.h>   /* for EXC_OV */
  30874. - #endif
  30875.   #endif
  30876.   #endif
  30877.   #include <signal.h>
  30878. --- 6,15 ----
  30879. diff -c runtime/ml_os.h /site/unicorn/export/src/Language/sml-0.75/src/runtime/ml_os.h
  30880. *** runtime/ml_os.h    Wed Nov  4 16:47:12 1992
  30881. --- /site/unicorn/export/src/Language/sml-0.75/src/runtime/ml_os.h    Tue Sep  8 09:54:05 1992
  30882. ***************
  30883. *** 94,106 ****
  30884.   /* cache-flushing stuff */
  30885.   
  30886.   #if defined(MIPS)
  30887. - #ifdef sony_news
  30888. - #include <machine/sysnews.h>
  30889. - #    define FlushICache(addr, size)      \
  30890. -         sysnews(NEWS_CACHEFLUSH, addr, size, FLUSH_ICACHE)
  30891. - /* SYS_sysnews will be defined in syscall.h, in OS 4.1 */
  30892. - #undef SYS_sysnews
  30893. - #else
  30894.   #ifndef MACH
  30895.   #include <sys/sysmips.h>
  30896.   #endif
  30897. --- 94,99 ----
  30898. ***************
  30899. *** 117,122 ****
  30900. --- 110,116 ----
  30901.   #    define FlushICache(addr, size)      \
  30902.           (syscall(SYS_sysmips, MIPS_CACHEFLUSH, (addr), (size), ICACHE, 0))
  30903.   #  endif
  30904. + #else
  30905.   #ifdef NeXT
  30906.   #  define FlushICache(addr, size)     asm ("trap #2")
  30907.   #else
  30908. ***************
  30909. *** 123,129 ****
  30910.   #  define FlushICache(addr, size)
  30911.   #endif
  30912.   #endif
  30913. - #endif
  30914.   
  30915.   #if defined(MACH) && defined(MIPS)
  30916.   
  30917. --- 117,122 ----
  30918. ***************
  30919. *** 139,145 ****
  30920.   #endif
  30921.   
  30922.   /* where to find syscall.h, used for getting the #define SYS_open */
  30923. ! #if defined(VAX) || defined(NeXT) || defined(MORE) || defined(sony_news)
  30924.   #include <syscall.h>
  30925.   #else
  30926.   #ifndef SGI
  30927. --- 132,138 ----
  30928.   #endif
  30929.   
  30930.   /* where to find syscall.h, used for getting the #define SYS_open */
  30931. ! #if defined(VAX) || defined(NeXT) || defined(MORE)
  30932.   #include <syscall.h>
  30933.   #else
  30934.   #ifndef SGI
  30935. Status: open
  30936. ----------------------------------------------------------------------
  30937. 665. Compiler bug: getSymbols on opening nonexistent structures.
  30938. Submitter: Pierre Cregut
  30939. Date: 11/5/92
  30940. Version: 0.91, 0.92a
  30941. Severity: minor
  30942. Problem: Compiler bug: getSymbols on opening nonexistent structures.
  30943. Transcript: 
  30944. Standard ML of New Jersey, Version 0.92a, November 2, 1992
  30945. val it = () : unit
  30946. - open A;
  30947. std_in:2.1-2.6 Error: unbound structure A
  30948. Error: Compiler bug: getSymbols
  30949. Fix: add ERROR_STR case to getSymbols function in elabstr.sml.
  30950. Status: fixed in 0.92 (dbm)
  30951. ----------------------------------------------------------------------
  30952. 666. top-level printout on open declarations
  30953. Submitter: John Reppy
  30954. Date: 11/6/92
  30955. Version: 0.91
  30956. Severity: minor
  30957. Problem: 
  30958.   When opening a structure, the bound datatypes don't get printed.
  30959. Transcript: 
  30960.   - structure Foo = struct datatype t = A | B val x = A end;
  30961.   structure Foo :
  30962.     sig
  30963.       datatype t
  30964.     con A : t
  30965.     con B : t
  30966.       val x : t
  30967.     end
  30968.   - open Foo;
  30969.   open Foo
  30970.   val x = A : t
  30971.   -
  30972. Comments:
  30973.   In fact, only dynamic components are printed, since only they are
  30974.   rebound in the top-level environment (to simplify stale-lvars cleanup).
  30975. Fix:
  30976.   Change printing of open declarations?
  30977. Status: open
  30978. ----------------------------------------------------------------------
  30979. 667. Compiler bug: getvars(STRdec)/fn opening a structure
  30980. Submitter:      Thomas Yan, tyan@cs.cornell.edu
  30981. Date:           11/10/92
  30982. Version:        0.91
  30983. Severity:       minor, but potentially very annoying
  30984. Problem:        ? pretty printing a structure created by functor application ?
  30985. Code:           functor A(type aa) = struct type a = aa list val a =[] end
  30986.                 structure A = A(type aa = int)
  30987.                 open A
  30988. Transcript:     Error: Compiler bug: getvars(STRdec)/fn
  30989. Fix: ignore special name "<Argument>" in elabDecl/makeDecl.
  30990. Status: fixed in 0.92 (dbm)
  30991. -----------------------------------------------------------------------
  30992. 668. missing info in syntax error messages
  30993. Submitter: Lal George
  30994. Date: 11/13/92
  30995. Version: 0.92c
  30996. Severity: major
  30997. Problem: 
  30998.   Some information has been lost from syntax error messages.
  30999. Transcript: (bug103.sml)
  31000.   {999}
  31001.  
  31002.   -----------------------diff new old ----------------------
  31003.   diff tsml.tmp /usr/local/sml/testing/bugs/outputs/bug103.out
  31004.   2,3c2
  31005.   < std_in:8.5 Error: syntax error
  31006.   < 
  31007.   ---
  31008.   > std_in:8.5 Error: syntax error found at RBRACE
  31009. Comments:
  31010.   The "found at" part of the message is missing from the new mlyacc/base.sml
  31011.   supplied by Tarditi.
  31012. Fix:
  31013.   This was a non-error-correcting version of base.sml that was inadvertently
  31014.   left in the mlyacc directory sent by Tarditi.  The fix was to build and 
  31015.   install the error-correcting version of base.sml.
  31016. Status: fixed in 0.92c
  31017. ----------------------------------------------------------------------
  31018. 669. redundant rule added in some matches
  31019. Submitter: Dave MacQueen
  31020. Date: 11/16/92
  31021. Version: 0.92c
  31022. Severity: major
  31023. Problem: 
  31024.   A rule is added to raise the match exception (and save a location
  31025.   message) in cases where it is redundant.
  31026.  
  31027. Code: 
  31028. Transcript: 
  31029.   - fun f(s,w) = f s w;
  31030.   std_in:0.0-0.0 Error: pattern and expression in val rec dec don't agree (circularity)
  31031.     pattern:    'Z -> 'Y -> 'X
  31032.     expression: 'Z * 'Y -> 'X
  31033.     in declaration:
  31034.       f =
  31035.     (fn (s,w) => <exp> <exp> w
  31036.      | _ => (<exp> := <exp>; raise <exp>))   <==== redundent rule
  31037. Fix:     
  31038.   Caused by switch to prettyprinter for absyn.  Left out call of trim
  31039.   to trim last default rule when printing match in CASEexp and FNexp.
  31040. Status: fixed in 0.92 (dbm)
  31041. ----------------------------------------------------------------------
  31042. 670. missing indicators in redundant match warning messages
  31043. Submitter: Dave MacQueen
  31044. Date: 11/16/92
  31045. Version: 0.88 through 0.92c
  31046. Severity: major
  31047. Problem: 
  31048.   In version 0.87 and earlier an arrow "-->" was printed in front of
  31049.   redundant rules in the warning message for redundant matches.
  31050. Code: (in file bug670.sml)
  31051.   fun f (true,x) = 0
  31052.     | f (true,nil) = 1
  31053.     | f (false, x) = 2
  31054.     | f w = 3;
  31055. Transcript: 
  31056.   Standard ML of New Jersey, Version 0.87, July 31, 1992
  31057.   val it = () : unit
  31058.   - use "bug670.sml";
  31059.   bug670.sml:1.1-4.11 Warning: redundant patterns in match
  31060.       (true,x) => ...
  31061.     -->   (true,nil) => ...
  31062.       (false,x) => ...
  31063.     -->   w => ...
  31064.   val f = fn : bool * 'a list -> int
  31065.  
  31066.   Standard ML of New Jersey, Version 0.92b, November 11, 1992
  31067.   val it = () : unit
  31068.   - use "bug670.sml";
  31069.   [opening bug670.sml]
  31070.   bug670.sml:1.1-4.11 Warning: redundant patterns in match
  31071.         (true,x) => ...
  31072.         (true,nil) => ...
  31073.         (false,x) => ...
  31074.         w => ...
  31075.  
  31076.   val f = fn : bool * 'a list -> int
  31077. Comments:
  31078.   I think that 0.88 was the version that incorporated Bill Aitken's
  31079.   rewrite of the match compiler, so it is probably caused by that
  31080.   change.
  31081. Fix: added a rev around call of fixupUnused in doMatchCompile in
  31082.      translate/mc.sml.  fixupUnused was returning a list of ints
  31083.      sorted in the wrong order.
  31084. Status: fixed in 0.92 (dbm)
  31085. ----------------------------------------------------------------------
  31086. 671. visibility of parameter in functor signature
  31087. Submitter:    Zhong Shao   (zsh@cs.princeton.edu)
  31088. Date:         Nov. 17, 1992
  31089. Version:      0.91
  31090. System:       all 
  31091. Severity:     major
  31092. Problem:      unbound structure in functor signature definitions
  31093. Code:
  31094. (* case 1 *)
  31095.  funsig FSIG(B : sig type t end) = sig val f : B.t end
  31096.  
  31097. (* case 2 *)
  31098.  funsig FSIG(structure B : sig type t end) = sig val f : B.t end
  31099.  
  31100. (* case 3 *)
  31101.  funsig FSIG(B : sig type t end) = sig val f : t end
  31102.  
  31103. (* case 4 *)
  31104.  funsig FSIG(structure B : sig type t end) = sig val f : t end
  31105.  
  31106. Transcript:
  31107.  
  31108.  haven% sml
  31109.  Standard ML of New Jersey, Version 0.91, October 26, 1992
  31110.  val it = () : unit
  31111.  -  funsig FSIG(B : sig type t end) = sig val f : B.t end;
  31112.  std_in:2.47-2.49 Error: unbound structure B in path B.t
  31113.  
  31114.  -  funsig FSIG(structure B : sig type t end) = sig val f : B.t end;
  31115.  std_in:0.0-0.0 Error: unbound structure B in path B.t
  31116.  
  31117.  -  funsig FSIG(B : sig type t end) = sig val f : t end;
  31118.  funsig FSIG(B:<sig>) = sig val f : <Argument>.<Parameter>.t end
  31119.  
  31120.  -  funsig FSIG(structure B : sig type t end) = sig val f : t end;
  31121.  std_in:2.57 Error: unbound type constructor t
  31122.  
  31123. Comments:  
  31124.  
  31125.  The code for case 1 and 2 should be valid, as they are in 89. 
  31126.  The code for case 3 and 4 should be rejected (intuitively) 
  31127.  
  31128. Fix:
  31129.   Here is the fix for the bug in signatures of functors:
  31130.   tulipe-cregut->diff elabsig.sml elabsig.sml~
  31131.   539,540c539,540
  31132.   <           of (NONE,_) => Normalize.openX(name_X,sgnArg,symtotalParent)
  31133.   <            | (SOME _ ,_) => 
  31134.   ---
  31135.   >           of (SOME _,_) => Normalize.openX(name_X,sgnArg,symtotalParent)
  31136.   >            | (NONE,_) => 
  31137.   It is just a stupid inversion...
  31138. Status: fixed in 0.93
  31139. ----------------------------------------------------------------------
  31140. 672. start() in i386 Mach
  31141. Submitter:      Mark Leone (mleone@cs.cmu.edu)
  31142. Date:        11/18/92
  31143. Version:        0.91
  31144. System:         i386 Mach
  31145. Severity:       minor
  31146. Problem:        start() is now _start() in i386 Mach.
  31147. Comments:    I386.prim.s used to require an #ifdef for Mach to set startptr 
  31148.         to start(), not _start().  This is no longer necessary.
  31149. Fix:
  31150. *** I386.prim.s.orig    Wed Nov 18 13:25:23 1992
  31151. --- I386.prim.s Wed Nov 18 13:24:13 1992
  31152. ***************
  31153. *** 651,658 ****
  31154.   /* this bogosity is for export.c */
  31155.         .globl  _startptr
  31156.   _startptr: 
  31157. - #if defined(I386) && defined(MACH)
  31158. -       .long   _start
  31159. - #else
  31160.         .long   start
  31161. - #endif
  31162. --- 651,654 ----
  31163. Status: fixed in 0.92
  31164. ----------------------------------------------------------------------
  31165. 673. failure of type propagation with higher-order functors
  31166. Submitter: Dave MacQueen
  31167. Date: 11/20/92
  31168. Version: 0.92
  31169. Severity: major
  31170. Problem: 
  31171.   Type information is not propagated through application of
  31172.   a parameter functor.
  31173. Code:  (bug673.sml)
  31174.   signature MONOID = 
  31175.   sig
  31176.     type t
  31177.     val plus: t*t -> t
  31178.     val e: t
  31179.   end;
  31180.  
  31181.   (* functor signature declaration *)
  31182.   funsig PROD (structure M: MONOID
  31183.            structure N: MONOID) = MONOID
  31184.  
  31185.   functor Square(structure X: MONOID
  31186.          functor Prod: PROD): MONOID =
  31187.       Prod(structure M = X
  31188.        structure N = X);
  31189.  
  31190.   functor Prod(structure M: MONOID
  31191.            structure N: MONOID): MONOID =
  31192.   struct
  31193.     type t = M.t * N.t
  31194.     val e = (M.e, N.e)
  31195.     fun plus((m1,n1),(m2,n2))=(M.plus(m1,m2),N.plus(n1,n2))
  31196.   end;
  31197.  
  31198.   structure Int =
  31199.   struct
  31200.     type t = int
  31201.     val e = 0
  31202.     val plus = (op +): int*int -> int
  31203.   end;
  31204.  
  31205.   structure Int2 = Square(
  31206.     structure X = Int
  31207.     functor Prod = Prod);
  31208.  
  31209.   #1(Int2.e);
  31210. Transcript:
  31211.   Standard ML of New Jersey, Version 0.92, November 18, 1992
  31212.   val it = () : unit
  31213.   - use "bug673.sml";
  31214.   [opening bug673.sml]
  31215.   signature MONOID =
  31216.     sig
  31217.       type t
  31218.       val plus : t * t -> t
  31219.       val e : t
  31220.     end
  31221.   funsig PROD(<Parameter>:<sig>) =
  31222.     sig
  31223.       type t
  31224.       val plus : t * t -> t
  31225.       val e : t
  31226.     end
  31227.   functor Square : <sig>
  31228.   functor Prod : <sig>
  31229.   structure Int :
  31230.     sig
  31231.       eqtype t
  31232.       val e : int
  31233.       val plus : int * int -> int
  31234.     end
  31235.   structure Int2 : MONOID
  31236.   bug673.sml:39.1-39.10 Error: operator and operand don't agree (type mismatch)
  31237.     operator domain: {1:'Y, '...Z}
  31238.     operand:         Int2.t
  31239.     in expression:
  31240.       (fn {1=1,...} => 1) (e)
  31241.   [closing bug673.sml]
  31242.   - 
  31243. Fix: [Cregut]
  31244.   diff elaborate/elabstr.sml elaborate/elabstr.sml~
  31245.   525,528c525,528
  31246.   <          fun computeSelf (StructStr _) = true
  31247.   <            | computeSelf (MarkStr(def,_,_)) = computeSelf def
  31248.   <            | computeSelf _ = false
  31249.   <          val self = computeSelf def
  31250.   ---
  31251.   >          val self = 
  31252.   >           (case def of VarStr _ => false 
  31253.   >                      | MarkStr(VarStr _,_,_) => false
  31254.   >                  | _ => true)
  31255.  
  31256.   Ok I think it fixes the problem: match thought that it could suppress its
  31257.   origin whereas it was a computed application to be done at each functor
  31258.   application. In the bogus version you could correct the problem 
  31259.   - by suppressing the signature MONOID
  31260.   - by putting an intermediate level of structure so that the optimisation
  31261.   of self was irrelevant (which is a kind of bug but we have already talked
  31262.   about it)
  31263.   (an intermediate level = functor Square(,,,) = struct structure result =
  31264.   Prod(...) end; )
  31265.  
  31266. Status: fixed in 0.93
  31267. ----------------------------------------------------------------------
  31268. 674. System.Env.filterEnv raises exception IntmapF
  31269. Submitter: Dave MacQueen
  31270. Date: 11/22/92
  31271. Version: 0.92
  31272. Severity: major
  31273. Problem: 
  31274.   System.Env.filterEnv raises exception IntmapF.
  31275. Transcript: 
  31276. - System.Env.filterEnv(!System.Env.pervasiveEnvRef,[System.Symbol.valSymbol "hd"]);
  31277.  
  31278. uncaught exception IntmapF
  31279. Comments: Probably related to bug 640.
  31280. Fix: fix lvarOfBinding in modules/moduleutil.sml
  31281. Status: fixed in 0.93a (dbm)
  31282. ----------------------------------------------------------------------
  31283. 675. prettyprinter doesn't sense System.Print.linewidth
  31284. Submitter: Konrad Slind
  31285. Date: 11/23/92
  31286. Version: 0.92
  31287. Severity: major
  31288. Problem: 
  31289.   System.Print.linewidth doesn't seem to control the linewidth used by the
  31290. system prettyprinter. 
  31291. Transcript: 
  31292.   $ sml
  31293.   Standard ML of New Jersey, Version 0.92, November 18, 1992
  31294.   val it = () : unit
  31295.   - System.Print.printLength := 10000;
  31296.   val it = () : unit
  31297.   - val L = ["adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa"];
  31298.   val L =
  31299.     ["adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa","adsfasd",
  31300.      "afasdfa","adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa",
  31301.      "adsfasd","afasdfa","adsfasd","afasdfa"] : string list
  31302.   - System.Print.linewidth := 20;
  31303.   val it = () : unit
  31304.   - L;
  31305.   val it =
  31306.     ["adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa","adsfasd",
  31307.      "afasdfa","adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa",
  31308.      "adsfasd","afasdfa","adsfasd","afasdfa"] : string list
  31309.   - System.Print.linewidth := 150;
  31310.   val it = () : unit
  31311.   - L;
  31312.   val it =
  31313.     ["adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa","adsfasd",
  31314.      "afasdfa","adsfasd","afasdfa","adsfasd","afasdfa","adsfasd","afasdfa",
  31315.      "adsfasd","afasdfa","adsfasd","afasdfa"] : string list
  31316.   - 
  31317. Status: open
  31318. ----------------------------------------------------------------------
  31319. 676. Out of order record field evaluation.
  31320. Submitter: Andrew Appel
  31321. Date: 11/24/92
  31322. Version: 0.92
  31323. Severity: Critical
  31324. Problem: 
  31325.   Out of order record field evaluation.
  31326. Transcript: 
  31327.   Standard ML of New Jersey, Version 0.92, November 18, 1992
  31328.   val it = () : unit
  31329.   - val r = ref 0;
  31330.   val r = ref 0 : int ref
  31331.   - fun g() = (inc r; !r);
  31332.   val g = fn : unit -> int
  31333.   - {last=g(),first=g()};
  31334.   val it = {first=1,last=2} : {first:int, last:int}
  31335. Status: fixed in 0.93 (Zhong Shao)
  31336. ----------------------------------------------------------------------
  31337. 677. memory leak
  31338. Submitter:      Kjeld H. Mortensen (kjeld@metasoft.com)
  31339. Date:           11/24/92
  31340. Version:        0.92
  31341. Systems:        Sparc server 330, SunOS 4.1.1,
  31342.                 HP9000s400, HPUX 8.0
  31343. Severity:       Major
  31344. Problem:        Memory leaks (heap grown when not supposed to).
  31345. Code:           
  31346. Transcript:    
  31347. Comments:
  31348. I have made experiments with SML/NJ v0.92 in order to see if there were
  31349. any memory leaks. It seems to me that it is the case.
  31350.  
  31351. My standard experiment is the same as from bug report #500, which was fixed
  31352. by v0.82. The bug was present in v0.75 and now in v0.92, but not to the 
  31353. same degree. I've included a bug report in case you think it should be
  31354. added to the masterbugs list. 
  31355.  
  31356. It is very important for us that the compiler doesn't slow down over a
  31357. longer period of usage, as a result of memory leaks. So I've given the
  31358. bug a high priority.
  31359.  
  31360. Using the compiler over a long period of time where stuff is only evaluated
  31361. or values "overwritten", the heap size increases unnecessarely (see also
  31362. bug #500).
  31363.  
  31364.  
  31365. (v0.92)  ----------Mem Size----------    
  31366.           start      end    end-start  ratio  softmax   slow down
  31367.  Sparc   19968 kb  21096 kb  1128 kb     3      28 Mb     26 %
  31368.  HPs400  11224 kb  11900 kb   676 kb     3      32 Mb     16 %
  31369.  
  31370. The table shows memory usage (as show by 'ps') at the beginning and end
  31371. of the experiment, the difference between end and start, ratio and softmax
  31372. (from System.Control.Runtime), and how much slower the compiler is at
  31373. the end as compared with the beginning of the experiment. The session lasts
  31374. 45 and 60 minutes for the HP and Sparc respectively.
  31375.  
  31376. I want to point out that the earlier version 0.82 doesn't have any
  31377. detectable memory leak and therefore no slow down.
  31378. Status: fixed in 0.93c
  31379. ----------------------------------------------------------------------
  31380. 678. emacs tags broken
  31381. Submitter:      Charlie Krasic (cckrasic@plg.uwaterloo.ca)
  31382. Date:           Nov. 24/92
  31383. Version:        0.92
  31384. System:         Sun 670/MP (Sparc) w/SunOS 4.3 (?)
  31385. Severity:       minor
  31386. Problem:        emacs tags broken when trying to create TAGS file for SML/NJ
  31387. Code:           modified the file 'all' to contain directives to toggle
  31388.                 indexing and markabsyn, then run smlc < all, then run
  31389.                 sml-tags -r.  I tried both my old version of sml-tags and
  31390.                 a newly built version of sml-tags.
  31391. Transcript:     no transcript.  Re-compiling the entire system creates the
  31392.                 various .i.xxx tag files.  Running "sml-tags -r" gives:
  31393.                     uncaught exception getIntError
  31394. Comments:    This precedure works fine if I use a batch compiler based on 0.91
  31395. Status: open
  31396. ----------------------------------------------------------------------
  31397. 679. "Compiler bug: addObject" while compiling the Edinburgh library
  31398. Submitter: wkh@dce.austin.ibm.com (Ward K. Harold)
  31399. Date: 11/25/92
  31400. Version: 0.92  (works up through version 0.82, fails in version 0.83)
  31401. System: RS6000, AIX 3.2, MIPS, SPARC
  31402. Severity: major
  31403. Problem: 
  31404.   "Compiler bug: addObject" while compiling the Edinburgh library, version
  31405.   1.20 or 1.21.  Occurs when loading MonoSet.sml in the MonoSet functor.
  31406. Code: (* simplified version: bug679.sml *)
  31407.   functor F (X: sig end) = (* has to be a functor, not a structure *)
  31408.   struct
  31409.     abstype s = S
  31410.     with
  31411.       type t = unit  (* type definition necessary *)
  31412.     end
  31413.   end
  31414. Transcript: 
  31415.   Standard ML of New Jersey, Version 0.92, November 18, 1992
  31416.   val it = () : unit
  31417.   - use "foo.sml";
  31418.   [opening foo.sml]
  31419.   Error: Compiler bug: addObject
  31420.   [closing foo.sml]
  31421.   - 
  31422. Fix: [Pierre Cregut]
  31423.   When I counted the number of components created in a structure that have a
  31424.   representation in the core, I forgot to count the components coming from the
  31425.   body of an abstype
  31426.  
  31427.   tulipe-cregut->diff elabstr.sml elabstr.sml~
  31428.   42,44c42,43
  31429.   <       | (AbstypeDec {abstycs,withtycs,body,...}, t) => 
  31430.   <          let val (strN,fctN,typN) = count (body,t)
  31431.   <          in (strN,fctN,typN+length abstycs+length withtycs) end
  31432.   ---
  31433.   >       | (AbstypeDec {abstycs,withtycs,...}, (strN,fctN,typN)) => 
  31434.   >          (strN,fctN,typN + length abstycs + length withtycs)
  31435.  
  31436. Status: fixed in 0.93
  31437. ----------------------------------------------------------------------
  31438. 680. Bad vertical alignment prettyprinting case expression.
  31439. Submitter: Dave MacQueen
  31440. Date: 11/20/92
  31441. Version: 0.92
  31442. Severity: minor
  31443. Problem: 
  31444.   Bad veritcal allignment prettyprinting case expression.
  31445. Transcript: 
  31446.   - if 2 then 3 else 4;
  31447.   std_in:0.0-0.0 Error: case object and rules don't agree (tycon mismatch)
  31448.     rule domain: bool
  31449.     object:      int
  31450.     in expression:
  31451.       (case 2
  31452.     of true => 3
  31453.        | false => 4)
  31454. Status: fixed in 0.93c
  31455. ----------------------------------------------------------------------
  31456. 681. building on SGI Indigos with cc version 3.10
  31457. Submitter: asgeir@viking.asd.sgi.com (Asgeir Eiriksson), Fernando Pereira
  31458. Date: 12/2/92
  31459. Version: 0.92
  31460. System: SGI R3000 and R4000 Indigo
  31461. Severity: Major
  31462. Problem: 
  31463.   sml fails to build with /usr/bin/cc version 3.10 (the latest)
  31464. Transcript: 
  31465.     cc -O  -DMIPS -D_BSD_SIGNALS -D__STDC__ -Dsgi -DSGI  -o run run.o run_ml.o callgc.o gc.o export.o timers.o  ml_objects.o cfuns.o cstruct.o signal.o exncode.o malloc.o  mp.o sync.o prim.o allmo.o 
  31466. /usr/bin/ld:
  31467. This executable contains branch instruction(s) at end-of-page
  31468. makeml> echo ( exportML "sml"; output(std_out,System.version); output(std_out,(chr 10)); output(std_out, "")); | runtime/run -m 8192 -r 5 -h 2048 IntMipsBig
  31469.  
  31470. [Increasing heap to 2051k]
  31471. [Loading mo/CoreFunc.mo]
  31472. ...
  31473.   
  31474. [closing boot/perv.sml]
  31475. [Loading boot/overloads.sml]
  31476. structure Overloads : ...
  31477. [closing boot/overloads.sml]
  31478. Go for it
  31479. [Major collection... 15% used (550960/3548736), 350 msec]
  31480.  
  31481. [Decreasing heap to 2699k]
  31482.  
  31483. [Major collection... 100% used (552208/552208), 320 msec]
  31484. ==> Inconsistent object for export: !(0)
  31485.  
  31486. uncaught exception Io "exportML "sml": Error 0"
  31487. -
  31488. Comments:
  31489.   This does not occur with the 2.10 version of cc.
  31490.   Reproducible on Fernando Pereira's Indigo.
  31491. Status: fixed in 0.93
  31492. ----------------------------------------------------------------------
  31493. 682. excess newlines in compiler warning message
  31494. Submitter:      Thomas Yan  tyan@cs.cornell.edu
  31495. Date:           12/2/92
  31496. Version:        .92
  31497. Severity:       minor
  31498. Problem:        extraneous blank lines printed during compilation
  31499. Code:           val [1,2,3] = [1,2,3]
  31500. Transcript:
  31501.     - val [1,2,3] = [1,2,3];
  31502.     std_in:55.1-55.21 Warning: binding not exhaustive
  31503.               1 :: 2 :: 3 :: nil = ...
  31504.     
  31505.     
  31506.     
  31507.     
  31508.     
  31509.     
  31510.     
  31511.     -
  31512. Comments: baffling the first time it appears
  31513. Fix: In print/ppdec.sml, make each declaration responsible for
  31514.   printing it's own terminating newline.
  31515. Status: fixed in 0.93c
  31516. ----------------------------------------------------------------------
  31517. 683. Compiler bug: Extern: update_structure 2
  31518. Submitter: Sanjiva Prasad <sanjiva@ecrc.de>
  31519. Date: 12/2/92
  31520. Version: 0.92
  31521. Severity: minor
  31522. Problem: 
  31523.  Elaborating an illegal signature decl leads to Compiler bug:
  31524.  Extern: update_structure 2.
  31525. Code:
  31526.   signature S =
  31527.   sig
  31528.     functor Foo(X: S) : S
  31529.   end
  31530. Transcript: 
  31531.   Standard ML of New Jersey, Version 0.92, November 18, 1992
  31532.   val it = () : unit
  31533.   - signature S =
  31534.   = sig
  31535.   =   functor Foo(X: S) : S
  31536.   = end;
  31537.   std_in:4.18 Error: unbound signature: S
  31538.   std_in:4.23 Error: unbound signature: S
  31539.   Error: Compiler bug: Extern: update_structure 2
  31540. Fix: [Pierre Cregut]
  31541.   update_structure didn't consider the case where an error had already been
  31542.   encountered. I have added two cases: the structure is an error, the
  31543.   signature is an error. Only the second one is proved to be necessary but the
  31544.   first one is safe.
  31545.  
  31546.   tulipe-cregut->diff extern.sml extern.sml~
  31547.   102,103d101
  31548.   <    | ERROR_STR => ()
  31549.   <    | INSTANCE{sign as ERROR_SIG,...} => ()
  31550. Status: fixed in 0.93
  31551. ----------------------------------------------------------------------
  31552. 684. Compiler bug: checkList
  31553. Submitter: Sanjiva Prasad <sanjiva@ecrc.de>
  31554. Date: 12/2/92
  31555. Version: 0.92
  31556. Severity: major
  31557. Problem: 
  31558.   A functor definition causes "Compiler bug: checkList".
  31559. Transcript: 
  31560.   - signature S1 = sig end;
  31561.   signature S1 = sig  end
  31562.   - funsig FOO (X:S1) (Y:S1) = S1;
  31563.   funsig FOO(X:<sig>) = sig functor <functor> : <sig> end
  31564.   - structure A:S1 = struct end;
  31565.   structure A : S1
  31566.   - functor Bar (C:S1) = C;
  31567.   functor Bar : <sig>
  31568.   - functor Foo (X:S1) (Y:S1) = X;
  31569.   functor Foo : <sig>
  31570.   - functor Foo:FOO = Foo;
  31571.   functor Foo : <sig>
  31572.   - funsig FOO2 (X:S1) = S1;      
  31573.   funsig FOO2(X:<sig>) = sig  end
  31574.   - functor Dummy (W: sig functor F :FOO2) (functor Z:FOO2) = Z(A);     
  31575.   std_in:9.38 Error: syntax error found at RPAREN
  31576.   - functor Dummy (W: sig functor F :FOO2 end ) (functor Z:FOO2) = Z(A); 
  31577.   functor Dummy : <sig>
  31578.   - functor Bar1 = Dummy (Foo(A)) (functor Z = Bar);
  31579.   std_in:10.16-10.47 Error: unmatched structure spec: F
  31580.   std_in:10.16-10.47 Error: unbound functor: <functor> in path <hidden>.<functor>
  31581.   - functor Dummy (W: S1)  (functor Z:FOO2) = Z(A); 
  31582.   functor Dummy : <sig>
  31583.   - functor Bar1 = Dummy (Foo(A)) (functor Z = Bar);
  31584.   std_in:11.16-11.47 Error: unbound functor: <functor> in path <hidden>.<functor>
  31585.   - structure C:S1 = struct functor G=Bar end;
  31586.   structure C : S1
  31587.   - open C;
  31588.   open C
  31589.   - structure C:S1 = Foo(A);
  31590.   structure C : S1
  31591.   - open C;
  31592.   open C
  31593.   - funsig ARBIT (B:S1) (type t) = S1;
  31594.   funsig ARBIT(B:<sig>) = sig functor <functor> : <sig> end
  31595.   - 
  31596.   - 
  31597.   - functor Bar5 = Foo (Foo A);
  31598.   std_in:18.25 Error: syntax error found at ID
  31599.   - functor Bar5 = Foo (Foo (A) );
  31600.   Error: Compiler bug: checkList
  31601.  
  31602. Code: (* bug684.sml *)
  31603.   (* the following reproduces the bug in 0.92 *)
  31604.   signature S = sig end;
  31605.   funsig FOO (X:S) (Y:S) = S;
  31606.   functor Foo (X:S) (Y:S) = X;
  31607.   functor Foo: FOO = Foo;  (* with this deleted produces different strange error *)
  31608.   structure A:S = struct end;
  31609.   structure C:S = Foo(A);  (* with this deleted, no error *)
  31610.   functor Bar5 = Foo(Foo(A)); (* ===> Error: Compiler bug: checkList *)
  31611.  
  31612. Comments:
  31613.     Currently one must view all arguments to a functor as structures.
  31614.     In particular, if an argument to a H-O functor is itself a functor,
  31615.     it is viewed as being a functor component of a structure
  31616.     argument.  
  31617.  
  31618.     But suddenly here, I found some funny behaviour when trying to treat
  31619.     results of part-applying curried functors as structures.
  31620.     I've attached the session transcript.  The symptoms were repeated when
  31621.     I replayed the session script in toto.  But when I tried to
  31622.     redo things with some of the chaff (irrelevant definitions and evaluations)
  31623.     removed, things worked fine.  The Compiler bug checkList was a surprise. 
  31624.  
  31625. Status: fixed in 0.93 (probably same as 673)
  31626. ----------------------------------------------------------------------
  31627. 685. loss of line numbers loading with System.Compile
  31628. Submitter: Gene Rollins
  31629. Date: 12/3/92
  31630. Version: 0.92
  31631. Severity: minor
  31632. Problem: 
  31633.   Code loaded into the interactive system using System.Compile does
  31634.   not give accurate line numbers when using System.Compile rather than
  31635.   use.
  31636. Code: 
  31637.   structure c :sig val c :string -> unit end = struct
  31638.  
  31639.   open System.Env System.Compile
  31640.  
  31641.   fun withSource (sourceName:string)
  31642.     (action :source -> 'a -> 'b) (argument:'a) :'b =
  31643.     let val sourceStream = open_in sourceName
  31644.     val source = makeSource (sourceName, 1, sourceStream, false, 
  31645.                  {linewidth= !System.Print.linewidth,
  31646.                   flush=System.Print.flush,
  31647.                   consumer=System.Print.say})
  31648.     val result = action source argument
  31649.                handle exn => (closeSource source; raise exn)
  31650.     in closeSource source; result end
  31651.  
  31652.   fun c (sourceName:string) :unit =
  31653.     let val env = layerEnv (!topLevelEnvRef, !pervasiveEnvRef)
  31654.     val se = staticPart env
  31655.     fun comp source () = compile (source, se)
  31656.     val compUnit = withSource sourceName comp ()
  31657.     in () end
  31658.  
  31659.   end
  31660.  
  31661.  
  31662.   ********** a.sml *******
  31663.   structure a = struct
  31664.     fun f [] = ()
  31665.   end
  31666.   ************************
  31667.  
  31668.   See the difference with:
  31669.  
  31670.   - c.c "a.sml";
  31671.   - use "a.sml";
  31672. Fix: In elaborate/frontend.sml, make parse smash linePos only for
  31673.   interactive source.
  31674.   Also fixed it so that compileAst can take an optional source parameter
  31675.   so linenumbers can be provided in error messages for elaborating and
  31676.   translating asts. (build/compile.sml, boot/system.sig)
  31677. Status: fixed in 0.93c
  31678. ----------------------------------------------------------------------
  31679. 686. floating-point divide by zero is broken on SGI
  31680. Submitter:     D. A. Ladd (ladd@graceland.ih.att.com)
  31681. Date:         November 30, 1992
  31682. Version:     0.91, 0.92
  31683. System:     SGI
  31684. Severity:     major
  31685. Problem:     floating-point divide by zero is broken
  31686. Code: 
  31687.     1.0 / 0.0;
  31688. Transcript: 
  31689.     Standard ML of New Jersey, Version 0.92, November 18, 1992
  31690.     val it = () : unit
  31691.     - 1.0 / 0.0;
  31692.     strange floating point error, 14
  31693. Comments:
  31694.     This works okay on other MIPS-based machines (e.g., hunny).
  31695. Status: fixed in 0.93
  31696. ----------------------------------------------------------------------
  31697. 687. src/Makefile is out of date.
  31698. Submitter: Fernando Pereira
  31699. Date: 12/4/92
  31700. Version: 0.92
  31701. Severity: major
  31702. Problem: src/Makefile is out of date.
  31703.  
  31704. First of all, the Makefile refers to ../tools/sourcegroup but the
  31705. distribution has SG2.2nj. With this fixed, various files seem to be
  31706. missing:
  31707.  
  31708.     cat ../tools/gnutags/export.sml | sml-export
  31709. Standard ML of New Jersey, Version 0.92, November 18, 1992
  31710. val it = () : unit
  31711. [opening ../tools/sourcegroup/src/StringXtra.sig]
  31712. [use failed: open_in "../tools/sourcegroup/src/StringXtra.sig": openf failed, No such file or directory]
  31713. uncaught exception (Loader): SystemCall
  31714.  
  31715. Then sml-conn fails to make because
  31716.  
  31717.     ../tools/sourcegroup/sml-conn/export.sml
  31718.  
  31719. is missing. Finally, sourcegroups fail to build with
  31720.  
  31721. [opening date.sml]
  31722. [use failed: open_in "date.sml": openf failed, No such file or directory]
  31723. [closing ../tools/sourcegroup/save.sml]
  31724. uncaught exception (Loader): SystemCall
  31725.  
  31726. Comments: the files required to build smlsg and sml-conn are all there
  31727. so they can be built manually. (sml-conn/export.sml no longer exists).
  31728. Fix: get rid of src/Makefile
  31729.  
  31730. Status: fixed in 0.93 (check)
  31731. ----------------------------------------------------------------------
  31732. 688. profiler doesn't compile
  31733. Submitter: Fernando Pereira
  31734. Date: 12/5/92
  31735. Version: 0.92
  31736. Severity: major
  31737. Problem: 
  31738.   Building the profiling version of sml fails while compiling
  31739.   profile/profperv.sml when executing
  31740.     sml < profile/script
  31741. Transcript: 
  31742.   [opening profile/profperv.sml]
  31743.   val it = () : unit
  31744.   profile/profperv.sml:73.17-73.26 Error: operator is not a function
  31745.     operator: bytearray
  31746.     in expression:
  31747.       ba sub
  31748.   profile/profperv.sml:79.18-79.32 Error: operator and operand don't agree (tycon mismatch)
  31749.     operator domain: bytearray
  31750.     operand:         (bytearray * int -> int) -> int -> 'Z
  31751.     in expression:
  31752.       length ba
  31753.   profile/profperv.sml:83.16-83.33 Error: operator and operand don't agree (tycon mismatch)
  31754.     operator domain: bytearray
  31755.     operand:         (bytearray * int -> int) -> int -> 'Z
  31756.     in expression:
  31757.       length ba
  31758.   profile/profperv.sml:88.29-88.41 Error: operator is not a function
  31759.     operator: bytearray
  31760.     in expression:
  31761.       ba sub
  31762.   [closing profile/profperv.sml]
  31763. Fix: add "infix 9 sub" just after "open ByteArray", because infixes are
  31764.   no longer carried by structures (signatures?). [ByteArray shouldn't
  31765.   be signature constrained because of inlining!!!]
  31766. Status: fixed in 0.93a
  31767. ----------------------------------------------------------------------
  31768. 689. Compiling lambda prolog fails with compiler bug "adjust_variable".
  31769. Submitter: Fernando Pereira
  31770. Date: 12/5/92
  31771. Version: 0.92
  31772. Severity: Critical
  31773. Problem: 
  31774.   Compiling lambda prolog fails with compiler bug "adjust_variable".
  31775. Code: elp.tar.Z
  31776. Transcript: 
  31777.   sgiharrar:lp$ sml-export
  31778.   Standard ML of New Jersey, Version 0.92, November 18, 1992
  31779.   val it = () : unit
  31780.   - use "export-elp.sml";
  31781.   .... lots of stuff ....
  31782.   [opening elp/elp_global_program.fun]
  31783.   elp/elp_global_program.fun:23.34-23.70 Error: operator and operand don't agree (type mismatch)
  31784.     operator domain: '2Z * '2Y
  31785.     operand:         '2Z * '2Y
  31786.     in expression:
  31787.       ref (imports,program)
  31788.   elp/elp_global_program.fun:23.7-24.26 Error: operator and operand don't agree (type mismatch)
  31789.     operator domain: string * (string list * Program.program) ref
  31790.     operand:         string * _
  31791.     in expression:
  31792.       ModuleState (module_name,ref (imports,program))
  31793.   elp/elp_global_program.fun:26.10-26.27 Error: operator and operand don't agree (type mismatch)
  31794.     operator domain: string * string
  31795.     operand:         string * string
  31796.     in expression:
  31797.       = (module_name,m1)
  31798.   elp/elp_global_program.fun:27.12-27.38 Error: operator and operand don't agree (type mismatch)
  31799.     operator domain: (string list * Program.program) ref
  31800.              * (string list * Program.program)
  31801.     operand:         (string list * Program.program) ref
  31802.              * (string list * Program.program)
  31803.     in expression:
  31804.       := (entry,(imports,program))
  31805.   Error: Compiler bug: adjust_variable
  31806.   [closing elp/elp_global_program.fun]
  31807.  
  31808. Status: fixed in 0.93 (probably related to bug 673 or 671)
  31809. ----------------------------------------------------------------------
  31810. 690. maskSignals breaks interactive input
  31811. Submitter:      Andrew Tolmach apt@cs.pdx.edu
  31812. Date:        12/8/92
  31813. Version:        0.92
  31814. System:         Sun4 SunOS, Sequent, probably others
  31815. Severity:       minor
  31816. Problem:        maskSignals breaks interactive input
  31817. Code:          
  31818.     
  31819. - System.Signals.maskSignals true;
  31820. - ^C
  31821.  
  31822. Transcript:  With above code, system goes into infinite loop.
  31823. Comments:  Any signal for which a handler is installed will do in place of
  31824.     CTRL/C.  The problem is in cfuns.c/ml_wait_for_in:
  31825.  
  31826.   restart:; /* on EINTR */
  31827.     if (msp->inSigHandler
  31828.     || ((! _setjmp (msp->SysCallEnv)) && 
  31829. (5)    (((msp->ioWaitFlag = 1), (msp->NumPendingSigs == 0))))) {
  31830.     ... 
  31831. (1)    select()
  31832.      ...
  31833.     }
  31834.     else {
  31835. (6)    backup_kont(msp);
  31836.     sigsetmask (0);  /* re-enable signals */
  31837.     return;
  31838.     }
  31839.    
  31840.     if (sts == -1) {
  31841.     if (errno == EINTR)
  31842. (4)        backup_kont(msp);
  31843.     else
  31844.         raise_syserror(msp, 0);
  31845.     return;
  31846.     }
  31847.  
  31848. and its interaction with signal.c/sig_handler:
  31849.  
  31850.     /* record the signal */
  31851. (2)   msp->NumPendingSigs++;
  31852.       msp->SigTbl[ml_sig]++;
  31853.  
  31854. (3)   if (!msp->maskSignals) {
  31855.     if (msp->ioWaitFlag) {
  31856.       /* We were waiting for a blocking I/O operation when the signal occurred,
  31857.        * so longjmp out of the operation (see io_wait() in "cfuns.c"). */
  31858.         _longjmp (msp->SysCallEnv, 1);
  31859.     }
  31860.     else ...
  31861.       }
  31862.  
  31863.  
  31864. Suppose we've called maskSignals false, setting msp->maskSignals to 
  31865. true, have called ml_wait_for_in, and are sitting in the select call 
  31866. (line 1) when a signal occurs.  The following occurs:
  31867.  
  31868. 1) The system invokes sig_handler, which increments NumPendingSigs 
  31869. (line 2) but doesn't longjmp out because of the test at line 3.
  31870.  
  31871. 2) The select call returns EINTR, so ml_wait_for_in calls backup_kont 
  31872. (line 4) to set up the ML state to reenter C immediately.
  31873.  
  31874. 3) When ml_wait_for_in is reentered, it refuses to recall select because
  31875. of the test on NumPendingSignals at line 5; instead, it calls backup_kont
  31876. again (line 6), and returns to C.  This step is then repeated forever.
  31877.  
  31878. Fix: One possiblity is to change the test in line 5 to:
  31879.  
  31880. (5)    (((msp->ioWaitFlag = 1), 
  31881.       (msp->NumPendingSigs == 0 || msp->maskSignals))))) {
  31882.  
  31883.  
  31884. Or, the position of the test against maskSignals could be changed in
  31885. sigHandler, so that the longjmp is always activated?  In that case,
  31886. EINTR should never be returned, right?
  31887.  
  31888. Comment [jhr]:
  31889.   I've thought about this, and I think that the correct fix is
  31890.   to check for masked signals in ml_wait_for_in (also in ml_select).
  31891.   In particular. the code should be
  31892.  
  31893.       if (msp->inSigHandler || msp->maskSignals || ...)
  31894.  
  31895.   since being in a signal handler implies masked signals.
  31896.  
  31897.   I would point out that calling maskSignals prior to calling
  31898.   ml_in_wait is bogus, since the whole point of ml_in_wait is
  31899.   to provide a safe place to interrupt when waiting for input.
  31900.  
  31901. Status: fixed in 0.93
  31902. ----------------------------------------------------------------------
  31903. 691. Compiler bug: ModuleUtil: lookFormalBinding 1
  31904. Submitter: Pierre Cregut
  31905. Date: 12/8/92
  31906. Version: 0.92
  31907. Severity: Major
  31908. Problem: Compiler bug: ModuleUtil: lookFormalBinding 1
  31909. Code: 
  31910.   signature S1 = sig type a ; val intro : unit -> a end;
  31911.   functor F4 
  31912.     (structure X1 : S1)
  31913.     (structure X2 : sig val x : X1.a end) =
  31914.   struct end;
  31915. Comments:
  31916.   But I am afraid there are other changes to make. The bug comes from
  31917.   FULL_SIG found while elaborating the argument of an embedded functor.
  31918.   There are other places where FULL_SIG are created. I will try to eliminate
  31919.   all of them.
  31920. Fix:
  31921.   Here is a fix:
  31922.   tulipe-cregut->diff elabstr.sml elabstr.sml~
  31923.   352,355c352
  31924.   <                              binding =
  31925.   <                                STR_FORMAL{
  31926.   <                                  pos=0,
  31927.   <                                  spec=signatureOfStructure argument},
  31928.   ---
  31929.   >                              binding = STR_FORMAL{pos=0,spec=FULL_SIG},
  31930.  
  31931. Status: fixed in 0.93
  31932. ----------------------------------------------------------------------
  31933. 692. signal handling on 386 can dump core
  31934. Submitter:      Andrew Tolmach apt@cs.pdx.edu
  31935. Date:        12/14/92
  31936. Version:        0.90+
  31937. System:         visible on Sequent; affects all 386 systems
  31938. Severity:       critical
  31939. Problem:        signal handling on 386 can dump core
  31940. Code:          
  31941.     
  31942. open System.Signals
  31943. fun alarmHandler(_,k) = k
  31944. val _ = setHandler(SIGALRM,SOME(alarmHandler))
  31945. open System.Timer
  31946. val setitimer = System.Unsafe.Cinterface.setitimer
  31947. fun h() = setitimer(0,TIME{sec=0,usec=10000} TIME{sec=0,usec=10000});
  31948. (* System can dump core at any time after h() is executed.
  31949.    The following sequence is quite reliable on Sequents: *)
  31950. val cd = System.Directory.cd;
  31951. fun r() = let fun f () = (cd "."; f()) in h(); f() end;
  31952. r();
  31953.  
  31954. Comments: 
  31955. The problem is that limitptr lives on the stack and is addressed
  31956. relative to %esp.  Unfortunately, various operations in the
  31957. 386 implemention (notably saveregs, some fp operations, and
  31958. all pc-relative loads in generated code) temporarily push things onto the
  31959. stack, thus altering %esp.   But the adjust_limit routine,
  31960. which zeroes the limitptr, may be executed by command of the signal
  31961. handler *at any time* when inML == 1; thus the wrong piece of the
  31962. "ML stack frame" gets zeroed (in this case the exncont).
  31963.  
  31964. Fix:
  31965.  
  31966. Add a field MLframe to the ML state vector (for 386's only), pointing
  31967. to the base of the ML stack frame.  This field is initialized by 
  31968. restoreregs before setting inML = 1.  The signal handler uses this
  31969. pointer to access and zero the limit pointer directly, avoiding the
  31970. need for an adjust_limit routine.
  31971.  
  31972. [I've sent Lal a bundle containing these changes.]
  31973.  
  31974. Longer-term fix:
  31975.  
  31976. If the 386 implementation were cleaned up so that it no longer messed
  31977. with %esp, use of the MLframe pointer in the signal handler
  31978. could be replaced by scp->sp.
  31979.  
  31980. Status: fixed in 0.93
  31981. ----------------------------------------------------------------------
  31982. 693. backspace (rubout char) under HPUX 8.0
  31983. Submitter:      M.J.Morley <mjm@uk.ac.ed.dcs>
  31984. Date:           17-12-92
  31985. Version:        Version 75, November 11, 1991
  31986. System:         HP 380/9000 under HP-UX 8.0
  31987. Severity:       minor bur, major irritation in all ML applications
  31988. Problem:        Backspace incorrectly bound?
  31989. Comments:       This was not manifest under HP-UX 7.0 but when we
  31990.                 recently switched to the HP-UX 8.0 the backspace
  31991.                 `stopped working'. Characters are rubbed out but this
  31992.                 effect is not echoed to the screen. The kit we use is
  31993.                 the standard HP config. screen/mouse/KB -- running
  31994.                 MIT's X11R4, in case that is significant.
  31995. Status: not our bug
  31996. ----------------------------------------------------------------------
  31997. 694. System.Compile.execute provokes compiler bug ModuleComp.getImport
  31998. Submitter:      Kjeld H. Mortensen (kjeld@metasoft.com)
  31999. Date:           12/21/92
  32000. Version:        0.92
  32001. System:         Sparc, SunOS 4.1.1
  32002. Severity:       major
  32003. Problem:        System.Compile.execute provokes ModuleComp.getImport
  32004.                 compiler bug msg
  32005. Code:           
  32006. The file "test.sml" used in the following is just:
  32007.   signature FOO =
  32008.   sig
  32009.     val x : int
  32010.   end;
  32011.  
  32012.   structure foo =
  32013.   struct
  32014.     val x = y
  32015.   end;
  32016.  
  32017. Transcript:     
  32018. Standard ML of New Jersey, Version 0.92, November 18, 1992
  32019. val it = () : unit
  32020. - val y= 0;
  32021. val y = 0 : int
  32022. - val myenv= System.Env.concatEnv (!System.Env.topLevelEnvRef, !System.Env.pervasiveEnvRef);
  32023. val myenv = prim? : environment
  32024. - val mystatenv= System.Env.staticPart myenv;
  32025. val mystatenv = prim? : staticEnv
  32026. - val myppcons= {linewidth= 79, consumer= (fn (x:string) => print x), flush= (fn () => ())};
  32027. val myppcons = {consumer=fn,flush=fn,linewidth=79}
  32028.   : {consumer:string -> unit, flush:unit -> unit, linewidth:int}
  32029. - val mystream= open_in "test.sml";                      (* See 'Code' above *)
  32030. val mystream = - : instream
  32031. - val mysrc = System.Compile.makeSource ("test.sml", 1, mystream, false, myppcons);
  32032. val mysrc = prim? : source
  32033. - val myStatxCode= System.Compile.compile (mysrc, mystatenv);
  32034. val myStatxCode = ({boundLvars=[10162],staticEnv=prim?},prim?)
  32035.   : System.Compile.staticUnit * codeUnit
  32036. - val mynewenv= System.Compile.execute (myStatxCode, myenv);
  32037. Error: Compiler bug: ModuleComp.getImport
  32038.  
  32039. uncaught exception Compile
  32040.  
  32041. Comment: [dbm] Free value variables in compilation units are not
  32042.   supported in 0.93.  This problem will go away in 0.94.
  32043.  
  32044. Status: not a bug
  32045. ----------------------------------------------------------------------
  32046. 695. segmentation fault involving System.Ast
  32047. Submitter: Gene Rollins
  32048. Date: 12/22/92
  32049. Version: 0.92
  32050. System: Decstation, Mach
  32051. Severity: critical
  32052. Problem: segmentation fault
  32053. Code: 
  32054.  
  32055.   structure bug = struct
  32056.  
  32057.   structure A = System.Ast
  32058.  
  32059.   fun ok m = (print ("\n<OK "^m^">\n"); flush_out std_out)
  32060.  
  32061.   val p1 = "functor G = H"
  32062.   val p2 = "functor F () = struct end"
  32063.  
  32064.   fun try program =
  32065.     let val ppc = {linewidth = !System.Print.linewidth,
  32066.            flush = System.Print.flush,
  32067.            consumer = System.Print.say}
  32068.     val strm = open_string (program ^ "\n")
  32069.     val src = System.Compile.makeSource ("", 1, strm, false, ppc)
  32070.     val start = System.Env.staticPart (!System.Env.pervasiveEnvRef)
  32071.     val (ast, se) = System.Compile.parse (src, start)
  32072.     in
  32073.       do_dec ast handle exn => (close_in strm; raise exn);
  32074.       close_in strm
  32075.     end
  32076.  
  32077.   and do_dec (ast:A.dec) :unit =
  32078.    (case ast of
  32079.        (A.ValDec _) => ()
  32080.      | (A.ValrecDec _) => ()
  32081.      | (A.FunDec _) => ()
  32082.      | (A.TypeDec _) => ()
  32083.      | (A.DatatypeDec _) => ()
  32084.      | (A.AbstypeDec _) => ()
  32085.      | (A.ExceptionDec _) => ()
  32086.      | (A.StrDec _) => ()
  32087.      | (A.AbsDec _) => ()
  32088.      | (A.FctDec (arg:A.fctb list)) => app f_fctb arg
  32089.      | (A.SigDec _)   => ()
  32090.      | (A.FsigDec _) => ()
  32091.      | (A.LocalDec _) => ()
  32092.      | (A.SeqDec arg) => app do_dec arg
  32093.      | (A.OpenDec _) => ()
  32094.      | (A.OvldDec arg) => ()
  32095.      | (A.FixDec arg) => ()
  32096.      | (A.ImportDec arg) => ()
  32097.      | (A.MarkDec (arg,_,_)) => do_dec arg
  32098.    )
  32099.   and f_fctb (ast:A.fctb) :unit =
  32100.    (case ast of
  32101.        (A.Fctb {name:symbol, def:A.fctexp}) => f_fctexp def
  32102.      | (A.MarkFctb (arg,_,_)) => f_fctb arg
  32103.    )
  32104.   and f_fctexp (ast:A.fctexp) :unit =
  32105.     let val _ =  ok "0" in
  32106.       case ast of
  32107.      (A.VarFct (path:A.path, constraint:A.fsigexp option)) =>
  32108.        let val _ = ok "1"
  32109.            val symbol'list = ((System.Unsafe.cast path) :symbol list)
  32110.        in
  32111.          case path of [] => ok "1a"
  32112.           | (head::tail) => (ok "1b"; System.Symbol.name head; ok "1c")
  32113.        end
  32114.        | (A.FctFct {params :(symbol option * A.sigexp) list, body :A.strexp,
  32115.         constraint :A.sigexp option}) => ok "2"
  32116.        | (A.MarkFct (arg,_,_)) => (ok "3"; f_fctexp arg)
  32117.     end
  32118.  
  32119.   end
  32120.  
  32121. Transcript: 
  32122.   - bug.try bug.p1;  (* ok *)
  32123.   - bug.try bug.p2;  (* causes segmentation fault *)
  32124. Comments:
  32125.   If you look at the output, it seems that in the function f_fctexp,
  32126.   the case on the ast should go on the FctFct branch for bug.p2, but it
  32127.   goes on the VarFct branch.
  32128.  
  32129.   When I try to bind the offending ast to a name at the top-level I get:
  32130.     Error: Compiler bug: PPVal.switch: none of the datacons matched
  32131. Fix: eternalized ast did not agree with internal ast on type fctexp.
  32132. Status: fixed in 0.93c (dbm)
  32133. ----------------------------------------------------------------------
  32134. 696. Type system error in "includes" of signatures
  32135. Submitter:      Chet Murthy (murthy@margaux.inria.fr)
  32136. Date:           29 Dec 1992
  32137. Version:        0.92
  32138. System:         sun4, sunos 4.1
  32139. Severity:       major
  32140. Problem:        Type system error in "includes" of signatures
  32141. Code:           see transcript
  32142. Transcript:     
  32143. I just found a bug in signature mechanism of 0.93.  It manifests
  32144. itself when I construct signatures by using "include".  I enclose a
  32145. short file which elicits the bug in the version of 0.93 which I
  32146. recuperated from research.att.com, around the end of november.
  32147.  
  32148. P.S.  The result of the bug is a bus error.
  32149. --------------cut here-------------------
  32150. structure A =
  32151. struct
  32152.  
  32153. type (''1a, '1b) t = ((''1a * '1b) list)
  32154.  
  32155. fun new() = nil
  32156. fun toList l = l
  32157. fun dom (l:(''a, 'b) t) = List.map #1 l
  32158.  
  32159. end
  32160.  
  32161. signature ASIG =
  32162.   sig
  32163.     type (''1a, '1b) t
  32164.     val new : unit -> (''1a, '1b) t
  32165.   end
  32166.  
  32167. signature BSIG =
  32168.   sig
  32169.     type (''1a, '1b) t
  32170.     val dom : (''1a, '1b) t -> ''1a list
  32171.   end
  32172. ;
  32173. signature AB_SIG =
  32174.   sig
  32175.     include ASIG BSIG
  32176.   end
  32177. ;
  32178. structure goo : AB_SIG = A;
  32179.  
  32180. let val _ = goo.dom (SOME "foo") in 23 end;
  32181.  
  32182. Fix [Cregut]:
  32183. tulipe-cregut->diff elabsig.sml elabsig.sml~
  32184. 68c68
  32185. <    fun adjustBinding (basetype,basestr,basefct,baseslot,makeStamp,redef) =
  32186. ---
  32187. >    fun adjustBinding (basetype,basestr,basefct,baseslot,makeStamp) =
  32188. 108,112d107
  32189. <         and relocate pos =
  32190. <               let fun reloc [] = pos+basetype
  32191. <                     | reloc ((porig,pdest)::l) =
  32192. <                          if pos = porig then pdest else reloc l
  32193. <               in reloc redef end
  32194. 125c120
  32195. <               FORMtyc{pos=relocate pos,
  32196. ---
  32197. >               FORMtyc{pos=pos+basetype,
  32198. 143c138
  32199. <                       RELtyc {name=name,pos=([],relocate offset)}
  32200. ---
  32201. >                       RELtyc {name=name,pos=([],offset+basetype)}
  32202. 181c176
  32203. <       val adjust = adjustBinding (!tycons,!strs,!fcts,!slots,makeStamp,redef)
  32204. ---
  32205. >       val adjust = adjustBinding (!tycons,!strs,!fcts,!slots,makeStamp)
  32206.  
  32207. Status: fixed in 0.93c
  32208. ----------------------------------------------------------------------
  32209. 697. wrong Subscript exception in ByteArray
  32210. Submitter:      Chet Murthy (murthy@margaux.inria.fr)
  32211. Date:        12/29/92
  32212. Version:        0.92
  32213. System:         Sun4, rel 4.1
  32214. Severity:       minor
  32215. Problem:        ByteArray.sub and ByteArray.update raise Array.Subscript
  32216.                 and not ByteArray.Subscript (otherwise named Ord)
  32217. Code:           let val x = ByteArray.array(10,0) in
  32218.                     ByteArray.sub(x,11) end
  32219. Transcript:     
  32220. Comments:
  32221. Fix:            In translate/inlineops.sml - the change was two
  32222. one-liners, to make "sub" and "update" return CoreInfo.exnOrd, instead
  32223. of CoreInfo.exnSubscript in inlstore and inlbyteof.  I enclose the
  32224. patch at the end.
  32225.  
  32226. *** inlineops.sml.~1~    Wed Nov 18 00:06:10 1992
  32227. --- inlineops.sml    Sat Dec 26 18:18:20 1992
  32228. ***************
  32229. *** 123,129 ****
  32230.                    COND(APP(PRIM(P.LESSU,predTy),
  32231.                             RECORD[vi,APP(PRIM(P.LENGTH,lengthTy),vs)]),
  32232.                         APP(PRIM(P.ORDOF,ordofty),RECORD[vs,vi]),
  32233. !                       RAISE(conToLexp(!CoreInfo.exnSubscript),INTty)))))
  32234.           end
  32235.    
  32236.   (* Bytearray store:
  32237. --- 123,129 ----
  32238.                    COND(APP(PRIM(P.LESSU,predTy),
  32239.                             RECORD[vi,APP(PRIM(P.LENGTH,lengthTy),vs)]),
  32240.                         APP(PRIM(P.ORDOF,ordofty),RECORD[vs,vi]),
  32241. !                       RAISE(conToLexp(!CoreInfo.exnOrd),INTty)))))
  32242.           end
  32243.    
  32244.   (* Bytearray store:
  32245. ***************
  32246. *** 154,160 ****
  32247.                         COND(APP(PRIM(P.LESSU,predTy),RECORD[vc,INT 256]),
  32248.                              APP(PRIM(P.STORE,storety),RECORD[vs,vi,vc]),
  32249.                              RAISE(conToLexp(!CoreInfo.exnRange),INTty)),
  32250. !                       RAISE(conToLexp(!CoreInfo.exnSubscript),INTty))))))
  32251.           end
  32252.   
  32253.   (*  String ordof:
  32254. --- 154,160 ----
  32255.                         COND(APP(PRIM(P.LESSU,predTy),RECORD[vc,INT 256]),
  32256.                              APP(PRIM(P.STORE,storety),RECORD[vs,vi,vc]),
  32257.                              RAISE(conToLexp(!CoreInfo.exnRange),INTty)),
  32258. !                       RAISE(conToLexp(!CoreInfo.exnOrd),INTty))))))
  32259.           end
  32260.   
  32261.   (*  String ordof:
  32262.  
  32263. Status: fixed in 0.93c (dbm)
  32264. ----------------------------------------------------------------------
  32265. 698. Uninformative nonexhaustive match warning messages.
  32266. Submitter: John Reppy
  32267. Date: 12/29/92
  32268. Version: 0.92
  32269. System: Sparcstation
  32270. Severity: major
  32271. Problem: Uninformative nonexhaustive match warning messages.
  32272.  
  32273. Transcript: 
  32274.   When compiling Isabelle/Pure:
  32275.  
  32276.   lexicon.ML:63.9-63.73 Warning: match nonexhaustive
  32277.         <pat> => ...
  32278.  
  32279.   lexicon.ML:55.9-61.62 Warning: match nonexhaustive
  32280.         <pat> => ...
  32281.         <pat> => ...
  32282.         <pat> => ...
  32283. Comments:
  32284.   Looks like printdepth is set to low, but doesn't happen at top level.
  32285.  
  32286.   [appel: Isabelle actively resets the print depth, and brings this problem
  32287.    upon itself.]
  32288.  
  32289. Status: not a bug
  32290. ----------------------------------------------------------------------
  32291. 699. "Compiler bug: ModuleUtil: lookFormalBinding 1" (secondary)
  32292. Submitter: John Reppy
  32293. Date: 12/31/92
  32294. Version: 0.93b
  32295. Severity: minor
  32296. Problem: 
  32297.   "Compiler bug: ModuleUtil: lookFormalBinding 1" generated as secondary
  32298.   error message after an unbound signature reference.
  32299. Code: (contents of file trace-cml.sml)
  32300.   functor TraceCML (
  32301.     structure CML : INTERNAL_CML
  32302.           and RunCML : RUN_CML
  32303.       and CIO : CIO  (* <== should have been signature CONCUR_IO *)
  32304.     sharing CML = RunCML.CML = CIO.CML
  32305.   ) : TRACE_CML = struct
  32306.  
  32307.     structure CIO = CIO
  32308.  
  32309.   (* where to direct trace output to *)
  32310.     datatype trace_to
  32311.       = TraceToOut
  32312.       | TraceToErr
  32313.       | TraceToNull
  32314.       | TraceToFile of string
  32315.       | TraceToStream of CIO.outstream
  32316.  
  32317.   end; (* TraceCML *)
  32318. Code: (simplified)
  32319.   functor F(structure A : sig end
  32320.             structure B : SXX   (* undefined sig SXX *)
  32321.         sharing A = B.C) =  (* undefined component B.C -- error msg *)
  32322.   struct end
  32323. Transcript: 
  32324.   [opening trace-cml.sml]
  32325.   trace-cml.sml:13.14-13.16 Error: unbound signature: CIO
  32326.   Error: Compiler bug: ModuleUtil: lookFormalBinding 1
  32327.   [closing trace-cml.sml]
  32328. Fix: added a case:
  32329.  
  32330.      | STRbind(STRvar{binding=STR_FORMAL{spec=ERROR_SIG,...},...}) =>
  32331.           raise ErrorStructure
  32332.  
  32333. in function lookFormalBinding in modules/moduleutil.sml.
  32334. Status: fixed in 0.93c
  32335. ----------------------------------------------------------------------
  32336. 700. wrong printing with toplevel vector pattern
  32337. Submitter: Dave MacQueen
  32338. Date: 1/3/93
  32339. Version: 0.93b
  32340. Severity: minor
  32341. Problem: 
  32342.   Top level does not print value bindings when a vector pattern is used.
  32343. Transcript: 
  32344. Standard ML of New Jersey, Version 0.93b, December 14, 1992
  32345. val it = () : unit
  32346. - val #[x,y,z] = #[1,2,3,];
  32347. std_in:2.1-2.23 Warning: binding not exhaustive
  32348.           #[x,y,z] = ...
  32349.  
  32350. -
  32351. - val [x,y] = [3,4];
  32352. std_in:0.0-0.0 Warning: binding not exhaustive
  32353.           x :: y :: nil = ...
  32354. val x = 3 : int
  32355. val y = 4 : int
  32356.  
  32357.  
  32358.  
  32359. -
  32360. Comment:
  32361.   Note also the extra newlines for the printing of the list bindings.
  32362. Status: fixed in 0.93c
  32363. ----------------------------------------------------------------------
  32364. 701. wrong types printed for top-level exception declarations
  32365. Submitter:      Andrzej Filinski <andrzej@cs.cmu.edu>
  32366. Date:        January 12, 1993
  32367. Version:        0.92  (November 18, 1992)
  32368. System:         all
  32369. Severity:       minor
  32370. Problem:        wrong types printed for top-level exception declarations
  32371. Transcript:     
  32372.     Standard ML of New Jersey, Version 0.92, November 18, 1992
  32373.     val it = () : unit
  32374.     - exception E;
  32375.     exception E            [ok]
  32376.     - exception E of int;
  32377.     exception E            [same for all non-functional types]
  32378.     - exception E of int->bool;
  32379.     exception E of int        [only codomain reported for functional types]
  32380. Fix: changed print/ppdec.sml
  32381. Status: fixed in 0.93c
  32382. ----------------------------------------------------------------------
  32383. 702. realfloor is unimplemented
  32384. Submitter:      Thomas Yan, tyan@cs.cornell.edu
  32385. Date:           1/12/93
  32386. Version:        .75, .92 (so presumably ever since .75)
  32387. Severity:       major
  32388. Problem:        realfloor is unimplemented
  32389. Comments:       hard to work around -- need to know/compute internal
  32390.                 representation of floats
  32391. Suggestion: [appel]
  32392.  
  32393. local 
  32394.    val maxint = 4503599627370496.0 (* This is the IEEE double-precision
  32395.                             maxint; won't work accurately on VAX *)
  32396.  
  32397.    fun realround x = if x>=0.0 then x+maxint-maxint else x-maxint+maxint
  32398.    (* realround(x) returns x rounded to some nearby integer, almost always
  32399.       the nearest integer. *)
  32400. in fun realfloor x = let val y = realround x
  32401.               in if y>x then y-1.0 else y
  32402.              end
  32403. end
  32404.  
  32405. Status: open
  32406. ----------------------------------------------------------------------
  32407. 703. betaexpand in cpsopt goes into infinite loop
  32408. Submitter:      Greg Morrisett
  32409. Date:        13 Jan 1993
  32410. Version:        0.92
  32411. System:         Mips Mach, Sparc Mach, (probably all)
  32412. Severity:       critical
  32413. Problem:        betaexpand in cpsopt goes into infinite loop
  32414. Code:        
  32415.   val rec f = fn true => f false | false => f true
  32416.  
  32417. Transcript:     
  32418.   Standard ML of New Jersey, Version 0.92, November 18, 1992
  32419.   val it = () : unit
  32420.   - val rec f = fn true => f false | false => f true;
  32421.  
  32422.   [Major collection...
  32423.   [Increasing heap to 2741k]
  32424.  
  32425.   [Increasing heap to 2941k]
  32426.  
  32427.   [Increasing heap to 3941k]
  32428.  
  32429.   [Increasing heap to 7001k]
  32430.    95% used (2120604/2211028), 2078 msec]
  32431.   <killed>
  32432.  
  32433. Comments:    Don't be fooled by the fact that this code doesn't
  32434.         terminate.  The original code that I whittled down
  32435.         to this *did* terminate.  It was a slight modification
  32436.         of cps/contract.sml.  Let me know if you want the
  32437.         original code...
  32438.  
  32439. Comment: [Greg, 1/18/93]
  32440. I'm not so sure that the problem is just in betaexpand, now.  The
  32441. example code I gave you compiles if you turn betaexpand off, but my
  32442. real code only compiles if you turn off all of cpsopt.
  32443.  
  32444. Comment: (awa)
  32445.  Compilation of his original (large) program did not infinite loop!  It merely
  32446.   kept going for approximately 14^6 beta-expansions, which took a long
  32447.   time and a lot of space.  [understatement]
  32448.  
  32449. Fix: [temporary. awa, 1/19/93]
  32450.   System.Control.CG.unroll := false;
  32451.   [permanent, awa, 1/20/93]
  32452.   Add "andalso n < max" to UNROLL case in body of function should_expand
  32453.   in cps/expand.sml.
  32454.   Also, let max=2, not max=5 (which was excessive)
  32455.  
  32456. Status: fixed in 0.93c (awa)
  32457. ----------------------------------------------------------------------
  32458. 704. System.Unsafe.SysIO.access raises exception instead of returning false
  32459. Submitter:     John Reppy (jhr@research.att.com)
  32460. Date:         January 14, 1993
  32461. Version:     0.93 (and earlier)
  32462. System:     all
  32463. Severity:     minor
  32464. Problem:     System.Unsafe.SysIO.access raises an exception when its argument
  32465.         is inaccessable, instead of returning false.
  32466. Code: 
  32467.     System.Unsafe.SysIO.access ("some-file-that-does-not-exist", []);
  32468. Transcript: 
  32469.     Standard ML of New Jersey, Version 0.93a, December 9, 1992
  32470.     val it = () : unit
  32471.     - System.Unsafe.SysIO.access ("some-file-that-does-not-exist", []);
  32472.  
  32473.     uncaught exception SystemCall
  32474.  
  32475. Comments:     In the long run, there should be a datatype for the return value
  32476.         of access, since it can fail for significantly different reasons
  32477.         (e.g., no such file, not a directory, looping path, ...).
  32478. Fix:        Change the code in cfuns.c to return false instead of raising
  32479.         SystemError
  32480. Status: fixed in 0.93
  32481. ----------------------------------------------------------------------
  32482. 705. sml emacs subprocess dies when file is "used"
  32483. Submitter: David Ladd (ladd@research.att.com)
  32484. Date: 1/21/92
  32485. Version: 0.93a
  32486. System: SGI, R3000, IRIX 4.0.4
  32487. Severity: major
  32488. Problem: 
  32489.   The following file works fine if ``used'' from the shell prompt, but
  32490.   dies when ``used'' under emacs.
  32491. Code: (file bug705.sml)
  32492.   exception foo;
  32493.   fun foo'(x) = raise foo;
  32494.   foo'(4);
  32495. Transcripe:
  32496.   Standard ML of New Jersey, Version 0.93a, December 9, 1992
  32497.   val it = () : unit
  32498.   - [opening /tmp/t]
  32499.   exception foo
  32500.   val foo' = fn : 'a -> 'b
  32501.   [closing /tmp/t]
  32502.  
  32503.   uncaught exception foo
  32504.   uncaught exception (Loader): SystemCall
  32505.  
  32506.   Process cmusml finished
  32507. Status: open  (can't reproduce)
  32508. ----------------------------------------------------------------------
  32509. 706. non-terminating structure compilation
  32510. Submitter:      Knut Omang (Univ. of Oslo), knuto@ifi.uio.no
  32511. Date:        Fri Jan  8 , 1993
  32512. Version:        0.75
  32513. System:         ds & sun4 (the below run done on a Sun Sparcstation 2)
  32514. Severity:       major
  32515. Problem:        non-terminating structure compilation
  32516. Code:           
  32517. --------
  32518. structure Queue1 =
  32519.   struct
  32520.     
  32521.     type 'a T = 'a list;
  32522.     exception E;
  32523.     
  32524.     fun hd(x::q) = x
  32525.       | hd [] = raise E;
  32526.   end
  32527.  
  32528. signature QUEUE = 
  32529.   sig
  32530.     type 'a T
  32531.     exception E
  32532.     val hd : 'a T -> 'b T
  32533.   end;
  32534.  
  32535. structure Q1: QUEUE = Queue1;
  32536.  
  32537. Transcript:     
  32538. ------------
  32539. Standard ML of New Jersey, Version 75, November 11, 1991
  32540. Arrays have changed; see Release Notes
  32541. val it = () : unit
  32542. - use "qm.sml";           
  32543. [opening qm.sml]
  32544. structure Queue1 : 
  32545.   sig
  32546.     eqtype 'a T
  32547.     exception E
  32548.     val hd : 'a list -> 'a
  32549.   end
  32550. signature QUEUE = 
  32551.   sig
  32552.     type 'a T
  32553.     exception E
  32554.     val hd : 'a T -> 'b T
  32555.   end
  32556.  
  32557. [Major collection...
  32558. [Increasing heap to 2116k]
  32559.  
  32560. [Increasing heap to 2636k]
  32561.  
  32562. [Increasing heap to 5236k]
  32563.  97% used (1614112/1649172), 1240 msec]
  32564.  
  32565. [Increasing heap to 8012k]
  32566.  
  32567. [Major collection...
  32568. [Increasing heap to 11916k]
  32569.  95% used (4137248/4349188), 3120 msec]
  32570.  
  32571. [Increasing heap to 12752k]
  32572. ^C[closing qm.sml]
  32573.  
  32574. Interrupt
  32575.  
  32576. Comments: This program should probably terminate quickly with an error msg..
  32577. Status: fixed since 0.75
  32578. ----------------------------------------------------------------------
  32579. 707. overloading in the profiler
  32580. Submitter: Lal George
  32581. Date: 1/21/93
  32582. Version: 0.93b
  32583. Severity: major
  32584. Problem: 
  32585.   Operators do not have their normal overloaded properties in the profiler.
  32586. Transcript: 
  32587.   - kisubi:$ smlp
  32588.   Standard ML of New Jersey, Version 0.93b, December 14, 1992[PROFILING]
  32589.   val it = () : unit
  32590.   - fun f x = x + 1;
  32591.   std_in:8.11-8.15 Error: operator and operand don't agree (tycon mismatch)
  32592.     operator domain: real * real
  32593.     operand:         real * int
  32594.     in expression:
  32595.       + (x,1)
  32596. Status: fixed in 0.93c (lal)
  32597. ----------------------------------------------------------------------
  32598. 708. array too large
  32599. Submitter: Carl Gunter
  32600. Date: 1/25/93
  32601. Version: 0.93b
  32602. System: Sparcstation
  32603. Severity: major
  32604. Problem: 
  32605.   Allocating very large array leads to strange behavior.
  32606. Transcript: 
  32607.   bolete% sml
  32608.   Standard ML of New Jersey, Version 0.93b, December 14, 1992
  32609.   val it = () : unit
  32610.   - open Array;
  32611.   ...
  32612.   - val A = array(100, true);
  32613.   val A = [|true,true,true,true,true,true,true,true,true,true,true,true,...|]
  32614.     : bool array
  32615.   - sub(A,5);
  32616.   val it = true : bool
  32617.  
  32618.   But this is different:
  32619.  
  32620.   bolete% sml
  32621.   Standard ML of New Jersey, Version 0.93b, December 14, 1992
  32622.   val it = () : unit
  32623.   - open Array;
  32624.   ...
  32625.   - val A = array(1073741823, true);
  32626.   val A = [||] : bool array
  32627.   - sub(A,5);
  32628.   val it = false : bool
  32629.   - sub(A, 13098);
  32630.  
  32631.   ... emacs window freezes ...
  32632.  
  32633. Comment:  the size is too large to fit in the 26 bits reserved in the
  32634. descriptor; the assembly language was not checking this.
  32635. Fix:  Change the ML code in perv.sml to check for size before calling
  32636.  assembly language.
  32637.  
  32638. Status: fixed in 0.93c
  32639. ----------------------------------------------------------------------
  32640. 709. bad indentation
  32641. Submitter: Dave MacQueen
  32642. Date: 1/26/92
  32643. Version: 0.93c
  32644. System: Mips Magnum, RISCos 4.52
  32645. Severity: minor
  32646. Problem: 
  32647.   System printout after opening a structure (System.Compile) has
  32648.   bad indentation.
  32649. Transcript: 
  32650. Standard ML of New Jersey, Version 0.93b, December 14, 1992
  32651. val it = () : unit
  32652. - open System.Compile;
  32653. open Compile
  32654. structure PP : sig type ppconsumer end
  32655. structure IO :
  32656.   sig
  32657.     type instream
  32658.     type outstream
  32659.   end
  32660. structure Ast : sig type dec end
  32661. exception Compile = Compile
  32662.   val makeSource = fn
  32663.     : string * int * instream * bool * System.PrettyPrint.ppconsumer -> source
  32664.   val closeSource = fn : source -> unit
  32665.   val changeLvars = fn : staticUnit -> staticUnit
  32666.   val elaborate = fn : source * staticEnv -> staticUnit
  32667.   val parse = fn : source * staticEnv -> Ast.dec * staticEnv
  32668.   val compile = fn : source * staticEnv -> staticUnit * codeUnit
  32669.   val compileAst = fn : Ast.dec * staticEnv * source option -> compUnit
  32670.   val execute = fn : (staticUnit * codeUnit) * environment -> environment
  32671.   val eval_stream = fn : instream * environment -> environment
  32672.   val use = fn : string -> unit
  32673.   val use_stream = fn : instream -> unit
  32674.   - 
  32675. Status: fixed in 0.93
  32676. ----------------------------------------------------------------------
  32677. 710. 0.0/0.0 generates strange float exception (on a NeXT)
  32678. Submitter:      Joel F. Klein, Joel.Klein@Rose-Hulman.EDU
  32679. Date:        1/28/93
  32680. Version:        0.75
  32681. System:         NeXTstation <hardware and OS version>
  32682. Severity:       minor
  32683. Problem:        0.0/0.0 generates strange float exception (on a NeXT)
  32684. Code:           0.0/0.0
  32685. Transcript:   
  32686.  
  32687.     mercutio 9:50pm > sml
  32688.     Standard ML of New Jersey, Version 75, November 11, 1991
  32689.     Arrays have changed; see Release Notes
  32690.     val it = () : unit
  32691.     - 0.0/0.0;
  32692.     strange floating point error, 0xd0
  32693.     mercutio 9:52pm > 
  32694.  
  32695. Comments: This is a known and "fixed" bug, but NeXTs don't know that.
  32696. Comments: [Joel Klein, 1/20/93]
  32697. I have additional information on bug report 710.  I left out which operating
  32698. system the NeXT was running.  This appears to be important, because the
  32699. "normal" NeXTs around here have a different response to the same input. Here's
  32700. the summary:
  32701.  
  32702. NeXT running NeXTstep 3.0:
  32703.   0.0/0.0 generates "strange float error"
  32704.  
  32705. NeXT running NeXTstep 2.0:
  32706.   0.0/0.0 returns 0.0
  32707.  
  32708. Example transscript of latter:
  32709. - 0.0/0.0;
  32710. val it = 0.0 : real
  32711. [Appel:]
  32712. SML/NJ 0.92 gives strange floating point error 0xd on NeXT 3.0.
  32713. Status: open
  32714. ----------------------------------------------------------------------
  32715. 711. SystemCall exceptions
  32716. Submitter: Benli Pierce
  32717. Date: 9/30/92
  32718. Version: 0.90
  32719. System: sparc
  32720. Severity: major
  32721. Problem: 
  32722. I've encountered one strange behavior while playing around with SML
  32723. 0.90 on a sparc.  Calls to System.system sometimes raise SystemCall
  32724. exceptions -- not in a fresh sml-sg image, but after a while, when a
  32725. few things have been compiled.
  32726.  
  32727. I thought it must be a problem with running out of virtual memory, but
  32728. I was able to get the same behavior after killing off several big
  32729. processes. 
  32730. Status: open
  32731. ----------------------------------------------------------------------
  32732. 712. Compiler bug: Modules.distributeT:f DD146
  32733. Submitter:      Tyng-Ruey Chuang, chuang@cs.nyu.edu
  32734. Date:           Oct. 27, 1992
  32735. Version:        0.75
  32736. System:         Sun Sparc, O.S. version 4.1.1
  32737. Severity:       not major
  32738. Problem:        Compiler-error when local specification is used with
  32739.                 type sharing equation in a signature declaration.
  32740. Code:           Note: named as "bug.sml" in Transcript.
  32741.  
  32742.  
  32743.   (*----------------------------------------------------------------------------*)
  32744.   (* Signature "FLIP" and its associated functor "Flip" *)
  32745.   
  32746.   signature FLIP =
  32747.   sig
  32748.       datatype Side = LHS | RHS
  32749.   end
  32750.   
  32751.   functor Flip () : FLIP =
  32752.   struct
  32753.       datatype Side = LHS | RHS   (* LHS for left-hand-side and
  32754.                                      RHS for right-hand-side *)
  32755.   end
  32756.   
  32757.   (*----------------------------------------------------------------------------*)
  32758.   (* Signature "FLOP" and its associated functor "Flop".
  32759.      Signature "FLOP" is identical(?) to "FLIP" though their names are different.
  32760.      Functor "Flop" should generate a structure identical to its input
  32761.      structure. *)
  32762.   
  32763.   signature FLOP =
  32764.   sig
  32765.   local
  32766.       structure flip : FLIP
  32767.   in
  32768.       datatype Side = LHS | RHS
  32769.       sharing type Side = flip.Side
  32770.   end
  32771.   end
  32772.   
  32773.   functor Flop (flip : FLIP) : FLOP =
  32774.   struct
  32775.   local
  32776.       structure flip = flip
  32777.   in
  32778.       open flip
  32779.   end
  32780.   end
  32781.   
  32782.   (*----------------------------------------------------------------------------*)
  32783.   (* A test to see if the following structures are identical(?). *)
  32784.   
  32785.   structure flip = Flip ()
  32786.   structure flop = Flop (flip)
  32787.   
  32788.   val identical = flip.LHS = flop.LHS
  32789.  
  32790.  
  32791. Transcript:
  32792.  
  32793.   Script started on Tue Oct 27 17:16:00 1992
  32794.   spunky% sml
  32795.   Standard ML of New Jersey, Version 75, November 11, 1991
  32796.   Arrays have changed; see Release Notes
  32797.   val it = () : unit
  32798.   - use "bug.sml";
  32799.   [opening bug.sml]
  32800.   bug.sml:24.5-24.26 Warning: LOCAL specs are only partially implemented
  32801.   Error: Compiler bug: Modules.distributeT:f DD146
  32802.   [closing bug.sml]
  32803.   - ^D
  32804.   spunky% ^D
  32805.   script done on Tue Oct 27 17:16:18 1992
  32806.  
  32807. Comments: The bug goes away if either local specifications in signatures
  32808.           are removed or sharing equation is removed.
  32809.  
  32810. For example:
  32811.  
  32812.   (*----------------------------------------------------------------------------*)
  32813.   (* Signature "FLIP" and its associated functor "Flip" *)
  32814.   
  32815.   signature FLIP =
  32816.   sig
  32817.       datatype Side = LHS | RHS
  32818.   end
  32819.   
  32820.   functor Flip () : FLIP =
  32821.   struct
  32822.       datatype Side = LHS | RHS   (* LHS for left-hand-side and
  32823.                                      RHS for right-hand-side *)
  32824.   end
  32825.   
  32826.   (*----------------------------------------------------------------------------*)
  32827.   (* Signature "FLOP" and its associated functor "Flop".
  32828.      Signature "FLOP" is identical(?) to "FLIP" though their names are different.
  32829.      Functor "Flop" should generate a structure identical to its input
  32830.      structure. *)
  32831.   
  32832.   signature FLOP =
  32833.   sig
  32834.       structure flip : FLIP                    (* NO local declaration here. *)
  32835.   
  32836.       datatype Side = LHS | RHS
  32837.       sharing type Side = flip.Side
  32838.   end
  32839.   
  32840.   
  32841.   functor Flop (flip : FLIP) : FLOP =
  32842.   struct
  32843.       structure flip = flip                    (* NO local declaration here. *)
  32844.   
  32845.       open flip
  32846.   end
  32847.   
  32848.   (*----------------------------------------------------------------------------*)
  32849.   (* A test to see if the following structures are identical(?). *)
  32850.   
  32851.   structure flip = Flip ()
  32852.   structure flop = Flop (flip)
  32853.   
  32854.   val identical = flip.LHS = flop.LHS
  32855.  
  32856. OR
  32857.  
  32858. (*----------------------------------------------------------------------------*)
  32859. (* Signature "FLIP" and its associated functor "Flip" *)
  32860.  
  32861. signature FLIP =
  32862. sig
  32863.     datatype Side = LHS | RHS
  32864. end
  32865.  
  32866. functor Flip () : FLIP =
  32867. struct
  32868.     datatype Side = LHS | RHS   (* LHS for left-hand-side and
  32869.                                    RHS for right-hand-side *)
  32870. end
  32871.  
  32872. (*----------------------------------------------------------------------------*)
  32873. (* Signature "FLOP" and its associated functor "Flop".
  32874.    Signature "FLOP" is identical(?) to "FLIP" though their names are different.
  32875.    Functor "Flop" should generate a structure identical to its input
  32876.    structure. *)
  32877.  
  32878. signature FLOP =
  32879. sig
  32880.     datatype Side = LHS | RHS
  32881. end
  32882.  
  32883. functor Flop (flip : FLIP) : FLOP =
  32884. struct
  32885.     open flip
  32886. end
  32887.  
  32888. (*----------------------------------------------------------------------------*)
  32889. (* A test to see if the following structures are identical(?). *)
  32890.  
  32891. structure flip = Flip ()
  32892. structure flop = Flop (flip)
  32893.  
  32894. val identical = flip.LHS = flop.LHS
  32895. Status: not a bug
  32896. ----------------------------------------------------------------------
  32897. 713. sourcegroups crashes in a non-deterministic fashion.
  32898. Submitter:      Lal George
  32899. Date:        28th Oct. '92
  32900. Version:        0.91
  32901. System:         RS6000
  32902. Severity:       major
  32903. Problem:        sourcegroups crashes in a non-deterministic fashion.
  32904. Code:           
  32905.     Compile sourcegroups version 2.2.
  32906.     (This was brought to my attention by cliff@cs.cornell.edu)
  32907.  
  32908. Transcript:     
  32909.  
  32910.     [/usr/u/plg/SMLofNJ/91/tools/sourcegroup] bashful% sml-91
  32911.     Standard ML of New Jersey, Version 0.91, October 26, 1992
  32912.     val it = () : unit
  32913.     - use "build.sml";
  32914.     [opening build.sml]
  32915.     val print'sigs = 2 : int
  32916.     val it = () : unit
  32917.     [opening load-all.sml]
  32918.     [opening local/System/interrupt.sig]
  32919.     signature INTERRUPT = ...
  32920.     [closing local/System/interrupt.sig]
  32921.     val it = () : unit
  32922.     [opening local/System/interrupt.sml]
  32923.     structure Interrupt : INTERRUPT
  32924.     [closing local/System/interrupt.sml]
  32925.     val it = () : unit
  32926.     [opening local/System/ioStream.sig]
  32927.     signature IO_STREAM = ...
  32928.     [closing local/System/ioStream.sig]
  32929.     val it = () : unit
  32930.     [opening local/System/ioStream.sml]
  32931.     structure IO_Stream : IO_STREAM
  32932.     [closing local/System/ioStream.sml]
  32933.     val it = () : unit
  32934.     [opening tools/sepcomp.sml]
  32935.  
  32936.     [Major collection...
  32937.     [Increasing heap to 2719k]
  32938.  
  32939.     [Increasing heap to 2979k]
  32940.      33% used (729592/2187412), 200 msec]
  32941.  
  32942.     [Increasing heap to 3643k]
  32943.     signature SEPCOMP = ...
  32944.     structure SepComp : SEPCOMP
  32945.     [closing tools/sepcomp.sml]
  32946.     val it = () : unit
  32947.     [opening tools/compile.sml]
  32948.     signature COMPILE = ...
  32949.     structure Compile : COMPILE
  32950.     [closing tools/compile.sml]
  32951.     val it = () : unit
  32952.     val it = () : unit
  32953.     val load = fn : string -> unit
  32954.     [reading base.sml]
  32955.  
  32956.     [Major collection...
  32957.     [Increasing heap to 3711k]
  32958.  
  32959.     [Increasing heap to 4051k]
  32960.      32% used (955024/2984028), 310 msec]
  32961.  
  32962.     [Increasing heap to 4743k]
  32963.  
  32964.     [Major collection... 17% used (697240/3897980), 230 msec]
  32965.     [closing base.sml]
  32966.     val it = () : unit
  32967.     [reading local/System/pathname.sig]
  32968.     [closing local/System/pathname.sig]
  32969.     val it = () : unit
  32970.     [reading local/System/ioStream.sig]
  32971.     [closing local/System/ioStream.sig]
  32972.     Illegal instruction
  32973. ======================================================================
  32974.  
  32975. Fix:     The bug is caused by the lack of cache flushing after code
  32976.     generation. Add the line System.Unsafe.CInterface.flush_cache <string>
  32977.     wherever appropriate.
  32978. Status: fixed in 0.93
  32979. ----------------------------------------------------------------------
  32980. 714. failure of ByteArray.update
  32981. Submitter: Fred Sullivan (sullivan@cs.rose-hulman.edu)
  32982. Date: 11/2/92
  32983. Version: 0.75
  32984. System: NeXT and Sun 3/SunOS
  32985. Severity: major
  32986. Problem: 
  32987.   ByteArry.update seems to fail in the following circumstances:
  32988.  
  32989.   1.  System.Control.interp is false.
  32990.   2.  update is called at top level.
  32991. Transcript: 
  32992.   Standard ML of New Jersey, Version 75, November 11, 1991
  32993.   Arrays have changed; see Release Notes
  32994.   val it = () : unit
  32995.   - open ByteArray;
  32996.   open ByteArray
  32997.   - val a = array(5, 65); 
  32998.   val a = - : bytearray
  32999.   - extract (a, 0, 5);
  33000.   val it = "AAAAA" : string
  33001.   - update (a, 3, 66);
  33002.   val it = () : unit
  33003.   - extract (a, 0, 5);
  33004.   val it = "AAAAA" : string
  33005.   - update (a, 0, 67);
  33006.   val it = () : unit
  33007.   -  extract (a, 0, 5);
  33008.   val it = "\000AAAA" : string
  33009.   - 
  33010.  
  33011.   If update is not called at top level, it seems to work:
  33012.  
  33013.   - fun foo (a, m, n) = update (a, m, n);
  33014.   val foo = fn : bytearray * int * int -> unit
  33015.   - foo(a, 0, 67);
  33016.   val it = () : unit
  33017.   - extract (a, 0, 5);
  33018.   val it = "CAAAA" : string
  33019.   - 
  33020. Status: fixed in 0.93
  33021. ----------------------------------------------------------------------
  33022. 715. chdir often doesn't work on strings of length 0 mod 4
  33023. Submitter:      Andrew Tolmach (apt@cs.pdx.edu)
  33024. Date:        6 Nov 92
  33025. Version:        0.90 (and perhaps earlier versions)
  33026. System:         all
  33027. Severity:       minor
  33028. Problem:        chdir often doesn't work on strings of length 0 mod 4
  33029. Code:           
  33030. System.Unsafe.CInterface.chdir "abcd";    (* this directory does exist *)
  33031.  
  33032. Transcript:     
  33033.  
  33034. % sml
  33035. Standard ML of New Jersey, Version 0.90 September 22, 1992
  33036. val it = () : unit
  33037. - System.Unsafe.CInterface.chdir "abcd";   (* this directory does exist *)
  33038.  
  33039. uncaught exception SysError
  33040. Comments: Caused by failure to call c_string on argument to chdir in 
  33041. boot/perv.sml.  String seen by C may have arbitrary garbage after it.
  33042. Fix:  Replace
  33043.  
  33044.   val chdir : string -> unit = c_function "chdir"
  33045.  
  33046. by 
  33047.  
  33048.   val chdir : string -> unit = c_function "chdir" o c_string
  33049.  
  33050. in boot/perv.sml.
  33051. Status: fixed in 0.93
  33052. ----------------------------------------------------------------------
  33053. 716. overflow on real operation crashes sml on sparc
  33054. Submitter:      Masahiro YASUGI < yasugi@is.s.u-tokyo.ac.jp >
  33055. Date:        Tue Nov 17 16:18:27 JST 1992
  33056. Version:        Standard ML of New Jersey, Version 75, November 11, 1991
  33057. System:         Sun4/SunOS Release 4.1.1-JLE1.1.1RevB
  33058. Severity:       rare
  33059. Problem:        An overflow on real number in sequential execution causes
  33060.         a crash of sml.
  33061. Code:
  33062.         fun bug r = ( r * r; r:real );
  33063.         bug 1.0E160;
  33064.     or
  33065.         fun bug r = ( r /0.0; r );
  33066.         bug 1.0;
  33067. Transcript:
  33068.         % sml
  33069.         Standard ML of New Jersey, Version 75, November 11, 1991
  33070.         Arrays have changed; see Release Notes
  33071.         val it = () : unit
  33072.         - fun bug r = ( r /0.0 ; r :real );
  33073.         val bug = fn : real -> real
  33074.         - bug 1.0;
  33075.         Segmentation fault
  33076.         %
  33077. Comments:    It seems to be a lower-level problem.
  33078. Status: open
  33079. ----------------------------------------------------------------------
  33080. 717. records always evaluated in alphabetical order
  33081. Submitter:      Thomas Yan, tyan@cs.cornell.edu
  33082. Date:           12/10/92
  33083. Version:        0.92
  33084. Severity:       major
  33085. Problem:        records always evaluated in alphabetical order
  33086. Code:           val _ = {b= print "1", a = print "2"}
  33087. Transcript:     - val _ = {b= print "1", a = print "2"};
  33088.                 21
  33089.                 -
  33090. Comments:       aren't records supposed to be evaluated in the order they
  33091.                 appear in program text?
  33092. Status: fixed in 0.93
  33093. ----------------------------------------------------------------------
  33094. 718. accepts type incorrect program, crashes
  33095. Submitter: Norman Neff    neff@trenton.edu
  33096. Date:        1/26/93
  33097. Version:        0.75
  33098. System:         Sun SPARC 1+     Sun OS 4.1.1
  33099. Severity:       critical
  33100. Problem:        compiler accepts type-incorrect program, execution nonterminates
  33101. Code:           <example code that reproduces the problem>
  33102.  
  33103. (* binary arithmetic *)
  33104. val max'digits=100;
  33105.     
  33106. structure Bins (*:
  33107.     sig
  33108.     exception add'oflow
  33109.     exception doub'oflow
  33110.     exception expadd'oflow
  33111.     exception btr'oflow
  33112.     exception btd'oflow
  33113.     val add'2 : ByteArray.bytearray * ByteArray.bytearray -> ByteArray.bytearray
  33114.     val subtract'2 : ByteArray.bytearray * ByteArray.bytearray -> ByteArray.bytearray
  33115.     val binary'to'int : ByteArray.bytearray -> int
  33116.     val is'zero : ByteArray.bytearray -> bool
  33117.     val binary'to'real : ByteArray.bytearray -> real
  33118.     val int'to'binary : int -> ByteArray.bytearray
  33119.     val real'to'binary : real -> ByteArray.bytearray
  33120.     val expadd : int * ByteArray.bytearray -> ByteArray.bytearray
  33121.